commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject Re: [Commons Configuration] Why this Java code rise a Exception ?
Date Tue, 02 Sep 2008 13:21:51 GMT
If you can, try to use Maven2.  It will download all the required
libraries and put them on your classpath for you (with IDE support for
eclipse and IDEA).  You can have it generate a template project for
you by doing:

mvn archetype:generate

and following the prompts.

On Tue, Sep 2, 2008 at 9:16 AM, Rodrigo Canabrava <canabrav@gmail.com> wrote:
> 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
>
>

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


Mime
View raw message