atom feed5 messages in org.codehaus.sonar.userRe: [sonar-user] Fatal "java.lang.NoC...
FromSent OnAttachments
Frank WilsonJun 29, 2011 9:07 am 
Frank WilsonJun 30, 2011 3:38 am.jpg
Freddy MalletJun 30, 2011 2:11 pm.jpg
Evgeny MandrikovJul 1, 2011 4:14 am.jpg
Mike VanJul 26, 2012 1:18 pm 
Subject:Re: [sonar-user] Fatal "java.lang.NoClassDefFoundError: org/apache/commons/configuration/Configuration" during sonar analysis
From:Frank Wilson (fran@sidonis.com)
Date:Jun 30, 2011 3:38:56 am
List:org.codehaus.sonar.user
Attachments:

It seems that after raising number of open files limit I am able to complete the analysis for the multi module build.

On linux (mint) this means putting something like the following in /etc/security/limits.conf (these values are probably unnecessarily high).

frank soft nofile 100000 frank hard nofile 150000

I would have expected the java VM to report IOException "too many open files" but all I got was NoClassDefFoundError.

I've seen someone previously posted about this, but it would seem he got the IOException and I did not.

Thanks,

Frank

I keep getting a fatal "java.lang.NoClassDefFoundError: org/apache/commons/configuration/Configuration" when I run a multi module build during the sonar analysis, the error is always on the same project. However, the analysis terminates sucessfully on that project when run as an individual build.

I even print out the classpath given to the sonar task, and its clear that commons-configuration is on the classpath.

[echo] sonar classpath = /home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar

[echo]
/home/frank/.m2/repository/org/apache/commons/commons-configuration/1.6/commons-configuration-1.6.jar

[echo]
/home/frank/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar

[echo]
/home/frank/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar

[echo]
/home/frank/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar

[echo]
/home/frank/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar

[echo]
/home/frank/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar

The commons-configuration-1.6.jar definately contains the Configuration.class file.

Any idea what might be causing this error?

FULL OUTPUT for sonar task:

sonar-task-depends: [artifact:dependencies] Maven Ant Tasks version: 2.1.1 [artifact:dependencies] Loading Maven settings file: /home/frank/.m2/settings.xml [artifact:dependencies] Using local repository: /home/frank/.m2/repository [artifact:dependencies] Resolving dependencies... [artifact:dependencies] Using remote repositories: - id=repo, url=http://morgan:8081/artifactory/repo, releases=enabled, snapshots=disabled - id=repo, url=http://morgan:8081/artifactory/repo, releases=enabled, snapshots=enabled org.apache.maven:super-pom:jar:2.0 (selected) org.sonar:sonar-ant-task:jar:1.1:compile (selected) org.apache.commons:commons-configuration:jar:1.6:compile (selected) commons-collections:commons-collections:jar:3.2.1:compile (selected) commons-lang:commons-lang:jar:2.4:compile (selected) commons-logging:commons-logging:jar:1.1.1:compile (selected) commons-digester:commons-digester:jar:1.8:compile (selected) commons-beanutils:commons-beanutils:jar:1.7.0:compile (selected) commons-logging:commons-logging:jar:1.0.3:compile (removed - nearer found: 1.1.1) commons-logging:commons-logging:jar:1.1:compile (removed - nearer found: 1.1.1) commons-beanutils:commons-beanutils:jar:1.7.0:compile (removed - nearer found: 1.8.0) commons-beanutils:commons-beanutils:jar:1.8.0:compile (selected) commons-logging:commons-logging:jar:1.1.1:compile (removed - nearer found: 1.1.1) Setting project property: org.sonar:sonar-ant-task:jar ->
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar Adding reference: org.sonar:sonar-ant-task:jar Setting project property: org.apache.commons:commons-configuration:jar ->
/home/frank/.m2/repository/org/apache/commons/commons-configuration/1.6/commons-configuration-1.6.jar Adding reference: org.apache.commons:commons-configuration:jar Setting project property: commons-collections:commons-collections:jar ->
/home/frank/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar Adding reference: commons-collections:commons-collections:jar Setting project property: commons-lang:commons-lang:jar -> /home/frank/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar Adding reference: commons-lang:commons-lang:jar Setting project property: commons-logging:commons-logging:jar ->
/home/frank/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar Adding reference: commons-logging:commons-logging:jar Setting project property: commons-digester:commons-digester:jar ->
/home/frank/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar Adding reference: commons-digester:commons-digester:jar Setting project property: commons-beanutils:commons-beanutils:jar ->
/home/frank/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar Adding reference: commons-beanutils:commons-beanutils:jar Adding reference: sonar.path

init-sonar-tasks: fileset: Setup scanner in dir /home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1 with patternSet{ includes: [sonar-ant-task-1.1.jar] excludes: [] } fileset: Setup scanner in dir /home/frank/.m2/repository/org/apache/commons/commons-configuration/1.6 with
patternSet{ includes: [commons-configuration-1.6.jar] excludes: [] } fileset: Setup scanner in dir /home/frank/.m2/repository/commons-collections/commons-collections/3.2.1
with patternSet{ includes: [commons-collections-3.2.1.jar] excludes: [] } fileset: Setup scanner in dir /home/frank/.m2/repository/commons-lang/commons-lang/2.4 with patternSet{ includes: [commons-lang-2.4.jar] excludes: [] } fileset: Setup scanner in dir /home/frank/.m2/repository/commons-logging/commons-logging/1.1.1 with patternSet{ includes: [commons-logging-1.1.1.jar] excludes: [] } fileset: Setup scanner in dir /home/frank/.m2/repository/commons-digester/commons-digester/1.8 with patternSet{ includes: [commons-digester-1.8.jar] excludes: [] } fileset: Setup scanner in dir /home/frank/.m2/repository/commons-beanutils/commons-beanutils/1.8.0 with
patternSet{ includes: [commons-beanutils-1.8.0.jar] excludes: [] } parsing buildfile jar:file:/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar!/org/sonar/ant/antlib.xml
with URI =
jar:file:/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar!/org/sonar/ant/antlib.xml
from a zip file Finding class org.sonar.ant.SonarTask Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/ant/SonarTask.class Class org.apache.tools.ant.Task loaded from parent loader (parentFirst) Class org.sonar.ant.SonarTask loaded from ant loader (parentFirst) Class java.lang.Object loaded from parent loader (parentFirst) Class java.lang.Throwable loaded from parent loader (parentFirst) Class java.io.IOException loaded from parent loader (parentFirst) Class java.io.Closeable loaded from parent loader (parentFirst) Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst) Class java.lang.Exception loaded from parent loader (parentFirst) Class java.lang.reflect.InvocationTargetException loaded from parent loader (parentFirst) Class java.lang.ClassLoader loaded from parent loader (parentFirst) Finding class org.sonar.batch.bootstrapper.BootstrapClassLoader Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/batch/bootstrapper/BootstrapClassLoader.class Class java.net.URLClassLoader loaded from parent loader (parentFirst) Class org.sonar.batch.bootstrapper.BootstrapClassLoader loaded from ant loader (parentFirst) +Datatype antlib:org.sonar.ant:sonar org.sonar.ant.SonarTask

sonar: Setting project property: sonar.sources -> /home/frank/EclipseWorkspaces/ProductX/Server/src Setting project property: sonar.host.url -> http://morgan:9000 Setting project property: sonar.jdbc.url -> jdbc:derby://morgan:1527/sonar [pathconvert] Set property formatted-sonar-path = /home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar [pathconvert]
/home/frank/.m2/repository/org/apache/commons/commons-configuration/1.6/commons-configuration-1.6.jar [pathconvert]
/home/frank/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar [pathconvert]
/home/frank/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar [pathconvert]
/home/frank/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar [pathconvert]
/home/frank/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar [pathconvert]
/home/frank/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar Setting project property: formatted-sonar-path ->
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar /home/frank/.m2/repository/org/apache/commons/commons-configuration/1.6/commons-configuration-1.6.jar /home/frank/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar /home/frank/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar /home/frank/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar /home/frank/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar /home/frank/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar [echo] sonar classpath = /home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar

[echo]
/home/frank/.m2/repository/org/apache/commons/commons-configuration/1.6/commons-configuration-1.6.jar

[echo]
/home/frank/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar

[echo]
/home/frank/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar

[echo]
/home/frank/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar

[echo]
/home/frank/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar

[echo]
/home/frank/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar [antlib:org.sonar.ant] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found. Class java.util.Properties loaded from parent loader (parentFirst) Class java.lang.String loaded from parent loader (parentFirst) Class java.io.File loaded from parent loader (parentFirst) Class org.apache.tools.ant.types.Environment$Variable loaded from parent loader (parentFirst) Class org.apache.tools.ant.types.Path loaded from parent loader (parentFirst) Class org.apache.tools.ant.Main loaded from parent loader (parentFirst) [sonar:sonar] Apache Ant(TM) version 1.8.2 compiled on December 20 2010 Class java.lang.StringBuilder loaded from parent loader (parentFirst) Class java.lang.Class loaded from parent loader (parentFirst) ResourceStream for org/sonar/ant/version.txt loaded from ant loader Finding class org.sonar.batch.bootstrapper.BootstrapperIOUtils Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/batch/bootstrapper/BootstrapperIOUtils.class Class org.sonar.batch.bootstrapper.BootstrapperIOUtils loaded from ant loader (parentFirst) Class java.io.Writer loaded from parent loader (parentFirst) Class java.io.StringWriter loaded from parent loader (parentFirst) [sonar:sonar] Sonar Ant Task version: 1.1 Finding class org.sonar.ant.Utils Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/ant/Utils.class Class org.sonar.ant.Utils loaded from ant loader (parentFirst) Class java.util.Vector loaded from parent loader (parentFirst) Class java.net.MalformedURLException loaded from parent loader (parentFirst) Resource org/sonar/ant/SonarTask.class loaded from ant loader Class java.net.URL loaded from parent loader (parentFirst) [sonar:sonar] Loaded from: file:/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar Class org.apache.tools.ant.Project loaded from parent loader (parentFirst) [sonar:sonar] Sonar work directory: /home/frank/EclipseWorkspaces/ProductX/Server/.sonar [sonar:sonar] Sonar server: http://morgan:9000 Finding class org.sonar.batch.bootstrapper.Bootstrapper Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/batch/bootstrapper/Bootstrapper.class Class org.sonar.batch.bootstrapper.Bootstrapper loaded from ant loader (parentFirst) Class java.util.List loaded from parent loader (parentFirst) Finding class org.sonar.batch.bootstrapper.BootstrapException Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/batch/bootstrapper/BootstrapException.class Class java.lang.RuntimeException loaded from parent loader (parentFirst) Class org.sonar.batch.bootstrapper.BootstrapException loaded from ant loader (parentFirst) Class java.io.Reader loaded from parent loader (parentFirst) Class java.io.InputStreamReader loaded from parent loader (parentFirst) Class java.io.OutputStream loaded from parent loader (parentFirst) Class java.io.FileOutputStream loaded from parent loader (parentFirst) ResourceStream for org/sonar/ant/version.txt loaded from ant loader Class java.net.HttpURLConnection loaded from parent loader (parentFirst) Finding class org.sonar.batch.bootstrapper.BootstrapperVersion Loaded from
/home/frank/.m2/repository/org/sonar/sonar-ant-task/1.1/sonar-ant-task-1.1.jar
org/sonar/batch/bootstrapper/BootstrapperVersion.class Class java.lang.Enum loaded from parent loader (parentFirst) Class org.sonar.batch.bootstrapper.BootstrapperVersion loaded from ant loader (parentFirst) ResourceStream for org/sonar/batch/bootstrapper/version.txt loaded from ant loader Class java.io.InputStream loaded from parent loader (parentFirst) [sonar:sonar] Sonar version: 2.8 Resource org/sonar/ant/SonarTask.class loaded from ant loader Class java.lang.ClassNotFoundException loaded from parent loader (parentFirst) Class java.util.ArrayList loaded from parent loader (parentFirst) Class java.util.Iterator loaded from parent loader (parentFirst) Class java.net.URI loaded from parent loader (parentFirst) Class java.lang.Thread loaded from parent loader (parentFirst) [ext:ant] Exiting /home/frank/EclipseWorkspaces/ProductX/Server/build.xml. [ext:ant] Exiting /home/frank/EclipseWorkspaces/ProductX/ApplicationBuild/build.xml. [ant] Exiting /home/frank/EclipseWorkspaces/ProductX/ApplicationBuild/build.xml.

BUILD FAILED /home/frank/EclipseWorkspaces/ProductX/ApplicationBuild/build-product.xml:84:
The following error occurred while executing this line: /home/frank/EclipseWorkspaces/ProductX/ApplicationBuild/build.xml:274: The following error occurred while executing this line: /home/frank/EclipseWorkspaces/ProductX/ApplicationBuild/build.xml:156: The following error occurred while executing this line: /home/frank/EclipseWorkspaces/ProductX/ApplicationBuild/jar-artifact-include.xml:184:
java.lang.NoClassDefFoundError: org/apache/commons/configuration/Configuration at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.getConstructor(Class.java:1657) at org.sonar.ant.SonarTask.delegateExecution(SonarTask.java:202) at org.sonar.ant.SonarTask.execute(SonarTask.java:189) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:809) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: java.lang.ClassNotFoundException: org.apache.commons.configuration.Configuration at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at org.sonar.batch.bootstrapper.BootstrapClassLoader.findClass(BootstrapClassLoader.java:52) at org.sonar.batch.bootstrapper.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:86) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 59 more

Total time: 8 minutes 55 seconds

Thanks,

Sidonis Limited. Registered No: 5718402. Registered Office: 2-4 Henry Street, Bath, Somerset. BA1 1JT. VAT Registration No: 879658932.