surefire maven memory problems

Problem:

[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: C:\...\target\surefire-reports
Error occurred during initialization of VM
Could not create the Java virtual machine.
Could not reserve enough space for object heap

Solution:
Edit your pom.xml and add configuration option for surefire forkMode none:

  <build>
    <plugins>
    (...)
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <forkMode>none</forkMode>
      </configuration>
    </plugin>
    (...)

Posted by wojtek Tue, 09 Mar 2010 16:27:00 GMT




maven antrun problem

Problem:
Using Maven 2.0.10 I got:

[INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-antrun-plugin:1.0:run': Unable to find the mojo 'org.apache.maven.plugins:maven-antrun-plugin:1.0:run' in the

 plugin 'org.apache.maven.plugins:maven-antrun-plugin'

Component descriptor cannot be found in the component repository: org.apache.maven.plugin.Mojoorg.apache.maven.plugins:maven-antrun-plugin:1.0:run.

Solution:


Using Maven 2.2.1 helped (this bug is fixed in 2.1.0+).

Posted by wojtek Sun, 07 Mar 2010 12:02:00 GMT




tomcat in eclipse staring problem

Problem:

java.lang.NoSuchMethodError: 
org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent.clearCache()V

Solution: run the eclipse updates - get the latest version and everything should work fine.

Posted by wojtek Mon, 01 Mar 2010 17:55:00 GMT




eclipse galileo with aptana hangs on ubuntu and then exits

Problem: Eclipse Galileo with Aptana plugin hangs and than after a minute or two exits. Logs say:

java.lang.NoSuchMethodError: method java.util.regex.Pattern.quote with signature (Ljava.lang.String;)Ljava.lang.String; was not found.
   at com.aptana.ide.desktop.integration.protocolhandler.ProtocolHandlerStartup
<clinit>(ProtocolHandlerStartup.java:31)
   at java.lang.Class.initializeClass(libgcj.so.90)
   at java.lang.Class.newInstance(libgcj.so.90)
   at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.
createExecutableExtension(RegistryStrategyOSGI.java:170)
   at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension
(ExtensionRegistry.java:874)
   at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension
(ConfigurationElement.java:243)
   at org.eclipse.core.internal.registry.ConfigurationElementHandle.
createExecutableExtension(ConfigurationElementHandle.java:51)
   at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:52)
   at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
   at org.eclipse.ui.internal.EarlyStartupRunnable.getExecutableExtension
(EarlyStartupRunnable.java:117)
   at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
   at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
   at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2192)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Solution: You are using GCJ java (try java –version in console). Insted of GCJ use Sun JDK.

Posted by wojtek Thu, 24 Sep 2009 15:08:00 GMT




Spring 2.0 to 2.5 migration TilesJstlView problem

Problem: After migrating Spring 2.0 to 2.5 you get

java.lang.ClassNotFoundException: org.springframework.web.servlet.view.tiles.TilesJstlView

Solution: you need the following library

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc-struts</artifactId>
  <version>2.5.6</version>
</dependency>

Posted by wojtek Wed, 01 Apr 2009 08:22:00 GMT




maven missing jmx dependencies

Problem:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.sun.jdmk:jmxtools:jar:1.2.1

  Try downloading the file manually from:
      http://java.sun.com/products/JavaManagement/download.html

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=
[id]

  Path to dependency: (...)


[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.sun.jmx:jmxri:jar:1.2.1

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


  Path to dependency: (...)

Solution: Download JMX 1.2.1 zip file from http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/download.jsp and extract it.

Add the filed to maven repository:

      mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file
      mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file

Posted by wojtek Mon, 30 Mar 2009 07:50:00 GMT




maven ear no libs included

Problem: even though you have the ear plugin configured with

<defaultJavaBundleDir>APP-INF/lib</defaultJavaBundleDir>

your libs still are not assembled into the ear file.

Probable solution: in my case it was the

<scope>prodived</scope>

for some of the dependencies that prevented the *.jar file from being added to the ear file. Solution is to change the scope (or leave the default one, than the libs will be included).

Posted by wojtek Fri, 27 Mar 2009 10:38:00 GMT




spring webflow test problem

Problem:

java.lang.IllegalStateException: Unable to create the default expression parser for Spring Web Flow: Neither a Unified EL implementation or OGNL could be found.
(...)
Caused by: java.lang.ClassNotFoundException: ognl.Ognl
(...)

Solution: add this dependency to your pom.xml (or download the library manually of you are not using maven)

    <dependency>
      <groupId>ognl</groupId>
      <artifactId>ognl</artifactId>
      <version>2.6.9</version>
    </dependency>

Posted by wojtek Tue, 24 Mar 2009 12:54:00 GMT




best free java decompiler eclipse plugin

Very nice one, and free!

http://sourceforge.net/projects/jadclipse/

Look through the options to see the details (Eclipse Window->Preferences->Java->JadClipse). One useful is “output original line numbers as comments”.

Posted by wojtek Thu, 16 Oct 2008 07:33:00 GMT




Eclipse Ganymede vs Spring IDE 2 problem

Problem: Eclipse Ganymede complains when trying to install Spring IDE.

Cannot complete the request.  See the details.
Unsatisfied dependency: 
[org.springframework.ide.eclipse.beans.mylyn 2.0.6.v200806241357] 
requiredCapability: osgi.bundle/org.eclipse.mylyn.monitor.core/[2.3.2,3.0.0)
Cannot find a solution where both Match[requiredCapability: 
osgi.bundle/org.eclipse.mylyn.monitor.core/[3.0.0,4.0.0)] 
and Match[requiredCapability: 
osgi.bundle/org.eclipse.mylyn.monitor.core/[2.3.2,3.0.0)] can be satisfied.
Unsatisfied dependency: 
[org.springframework.ide.eclipse.mylyn 2.0.6.v200806241357] 
requiredCapability: osgi.bundle/org.eclipse.mylyn.ide.ui/[2.3.2,3.0.0)
Unsatisfied dependency: 
[org.springframework.ide.eclipse.beans.mylyn 2.0.6.v200806241357] 
requiredCapability: osgi.bundle/org.eclipse.mylyn.ide.ui/[2.3.2,3.0.0)
(etc...)

Solution: Uncheck “Spring IDE Mylyn integration plugin” while doing the installation.

Posted by wojtek Wed, 02 Jul 2008 09:35:00 GMT