Hi All,
Posted this issue on StackOverflow but no luck so hoping I'll get some responses here.
We are using BeanIO to read an XML file and I am able to load the mapping file fine and everything runs great when we test it in Eclipse. However once everything is packaged in a jar file and we try to run it we get class not found exceptions. The ClassNotFoundExceptions occurs on the custom type handlers we have defined. The ClassNotFoundException is as shown below
Caused by: java.lang.ClassNotFoundException: com.findata.typehandlers.LanguageTypeHandler
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 java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.beanio.internal.util.BeanUtil.createBean(BeanUtil.java:83) ... 20 more
The kicker is that the application runs fine in Eclipse since it can find LanguageTypeHandler.class in the class path. This is our first BeanIO project so I'm not sure if we have it configured correctly. In the mapping file we simply specify that class LanguageTypeHandler as below. It seems to be configured correctly since again everything works in Eclipse but not as a stand alone jar.
BeanIO's BeanUtil class is what initiates the classloader as once can see in line 80 ( We are using BeanIO Release 2.1.0.M1)
Class<?> clazz = null;
try {
// load the class
clazz = classLoader.loadClass(className);
}
catch (ClassNotFoundException e) {
throw new BeanIOConfigurationException(
"Class not found '" + className + "'", e);
}
Any help would greatly be appreciated.