Hey all in Servoy-Land, got a bit of a brain bender if anyone has any insights.
Working on a WebServices plugin, and using the Apache Axis2 libraries to generate everything in Eclipse. So far everything works quite well…as long as I’m running it in Developer mode. However, as soon as we try to do anything in client mode, we start running into problems, and get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/axis2/databinding/ADBBean
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 com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.adblocks.plugin.erevision.wrapper.ERevision.getScriptObject(ERevision.java:39)
at com.servoy.j2db.scripting.i.get(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:726)
at org.mozilla.javascript.gen.c658.call(getERevInventoryForLine:103)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.gen.c657.call(getZoneAvails:120)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
The root of the problem seems to be here at com.adblocks.plugin.erevision.wrapper.ERevision.getScriptObject(ERevision.java:39), where I am making my instantiation of the class for the provider. What appears to be going on is that the JNLPClassLoader can’t find a handful (possibly all, but I think it’s only some) of the Axis2 Libraries. The Axis2 libraries are located in a sub folder of the plugins: \plugins\Axis2
In the past i have been able to solve this by running some code like the following
ClassLoader orig = Thread.currentThread.getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
...
//code here
...
Thread.currentThread().setContextClassLoader(orig);
However, that doesn’t seem to be working this time. I’ve also tried a similar iteration of the above code, but switching to the parent ClassLoader of the current one, also to no avail.
After scouring the forums, I found that some people had luck by placing all subfolder libraries int he root of the plugin folder. I find this to be a messy solution (there are 59 Axis libraries!), but was willing to try it out. That also got me nowhere.
Then I tried creating a custom JNLP file for the plugin that included all the Axis libraries explicitly in the resources section (much as I have seen in Marcel’s and Patrick’s plugins). I had high hopes for this one, but, again, I was disappointed.
So that leaves me here, not quite knowing what to do from here, and hoping for some help. Thanks in advance for any tips!