Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EasyConf NestableRuntimeException

 
Ravi kapa
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,iam using "EasyConf" for properties configuration i just tried to read and print the variable from the properties file and getting one runtime exception that is "NestableRunTimeException".Can anyone guide me what is wrong..i included all the necessary jars
those jars are
commons-configuration 1.1
commons-collections 3.1
commons-lang 2.0
dom4j 1.4
commons-logging 1.0.4
commons-digester 1.6
commons-beanutils (core and collections) 1.7.0...

i created calculator.properties file under src with the variable euro-to-dollars=1.2

my source code
===============
import com.germinus.easyconf.ComponentConfiguration;
import com.germinus.easyconf.ComponentProperties;
import com.germinus.easyconf.EasyConf;

public class EasyCDemoEx{
public static void main(String[] args) {
System.out.println("1");
final double EURO_TO_DOLLARS_RATIO = EasyConf.
getConfiguration("calculator").getProperties().
getDouble("euro-to-dollars");
System.out.println(EURO_TO_DOLLARS_RATIO);

}
}

output(Exception)
===============

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(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.easy.demo.EasyConfDemo.main(EasyConfDemo.java:8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 18 more
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you didn't set your classpath correctly. You say you have the commons-lang JAR - that is where the NestableRuntimeException is located. So you may have downloaded it but it seams like you did not add it to the classpath correctly.

Also, make sure you have the correct version of commons-lang on the classpath. The latest version (3.x) uses the org.apache.commons.lang3 package instead of org.apache.commons.lang, and does not have a NestableRuntimeException. You need to use a 2.x version of the commons-lang JAR.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic