commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [Commons Configuration] Why this Java code rise a Exception ?
Date Tue, 02 Sep 2008 19:49:17 GMT
Pierre8rou schrieb:
> Hello,
> 
> Why this Java code rise a Exception in thread "main"
> java.lang.NoClassDefFoundError  ?
> 
> Thanks,
> 
> Pierre8r

As was already pointed out by others on this thread, Commons 
Configuration requires some other Commons libraries. Detailed 
information about which libraries you need at runtime under which 
conditions can be found on the "Runtime dependencies" page [1].

Oliver

[1] http://commons.apache.org/configuration/dependencies.html

> 
> 
> 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
> 
> 
> 
> 
> 
> 


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


Mime
View raw message