commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo Canabrava" <canab...@gmail.com>
Subject Re: [Commons Configuration] Why this Java code rise a Exception ?
Date Tue, 02 Sep 2008 13:16:10 GMT
I guess you need to put commons lang in the classpath as well. Then
you won't have the NoClassDefFoundError anymore, but you will still
probably have an exception. But the original exception is lost because
of the NoClassDefFoundError.

a+
Rodrigo


2008/9/1 Pierre8rou <pierre8r-nabble@yahoo.fr>:
>
> Hello,
>
> Why this Java code rise a Exception in thread "main"
> java.lang.NoClassDefFoundError  ?
>
> Thanks,
>
> Pierre8r
>
>
> package com.test.configuration;
>
> import org.apache.commons.configuration.BaseConfiguration;
>
> public class testCommonsConfig001 {
>
>        public static void main(String[] args) {
>
>                BaseConfiguration config = new BaseConfiguration();
>
>                config.addProperty("intProperty", 22);
>                System.out.println(config.getInt("intProperty"));
>
>        }
> }
>
>
> The output console :
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/lang/exception/NestableRuntimeException
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClass(Unknown Source)
>        at java.security.SecureClassLoader.defineClass(Unknown Source)
>        at java.net.URLClassLoader.defineClass(Unknown Source)
>        at java.net.URLClassLoader.access$000(Unknown Source)
>        at java.net.URLClassLoader$1.run(Unknown Source)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClass(Unknown Source)
>        at java.security.SecureClassLoader.defineClass(Unknown Source)
>        at java.net.URLClassLoader.defineClass(Unknown Source)
>        at java.net.URLClassLoader.access$000(Unknown Source)
>        at java.net.URLClassLoader$1.run(Unknown Source)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>        at
> com.test.configuration.testCommonsConfig001.main(testCommonsConfig001.java:9)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.lang.exception.NestableRuntimeException
>        at java.net.URLClassLoader$1.run(Unknown Source)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>        ... 25 more
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/-Commons-Configuration--Why-this-Java-code-rise-a-Exception---tp19260543p19260543.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message