Class Loading Issues
It is possible that the Java libraries you have specified in the plugin libraries
list
conflict with the ones already loaded by Oxygen XML Editor plugin. To instruct the plugin to
prefer its libraries over the ones used by Oxygen XML Editor plugin, you can add the following
attribute on the <plugin>
root element:
classLoaderType="preferReferencedResources"
from the
plugin.xml
descriptor.
A Late Delegation Class Loader (the main class loader in Oxygen XML Editor plugin) is a
java.net.URLClassLoader
extension that prefers to search classes in its own
libraries list and only if a class is not found there to delegate to the parent class
loader.
The main Oxygen XML Editor plugin Class Loader uses as libraries all jars specified in the
[OXYGEN_INSTALL_DIR]\lib
directory. Its parent class loader is the default JVM Class loader. For each plugin
instance,
a separate class loader is created having as parent the Oxygen XML Editor plugin Class
Loader.
The plugin class loader can be either a standard java.net.URLClassLoader
or
a LateDelegationClassLoader
(depending on the attribute
classLoaderType
in the plugin.xml
). Its parent class
loader is always the Oxygen XML Editor plugin
LateDelegationClassLoader
.
If you experience additional problems, such as:
java.lang.LinkageError: ClassCastException: attempting to cast jar:file:/C:/jdk1.6.0_06/jre/lib/rt.jar!/ javax/xml/ws/spi/Provider.class tojar:file:/D:/Program Files/Oxygen XML Editor 12/plugins/wspcaccess/../../xdocs/lib/jaxws/ jaxws-api.jar!/javax/xml/ws/spi/Provider.class at javax.xml.ws.spi.Provider.provider( Provider.java:94) at javax.xml.ws.Service.<init>(Service.java:56) .............................................The cause could be the fact that some classes are instantiated using the context class loader of the current thread. The most straightforward fix is to write your code in a try/finally statement:
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); try { //This is the implementation of the //WorkspaceAccessPluginExtension plugin interface. Thread.currentThread().setContextClassLoader( CustomWorkspaceAccessPluginExtension. this.getClass().getClassLoader()); //WRITE YOUR CODE HERE } finally { Thread.currentThread(). setContextClassLoader(oldClassLoader); }