|RE: [equinox-dev] FW: Classloader problem|
We've been experimenting with the following properties:
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.jsse2, \
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.jvm, \
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.lang.management, \
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.misc, \
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.nio.cs, \
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.oti.*, \
ÂÂÂÂÂÂÂÂÂÂÂ com.ibm.security.*, \
ÂÂÂÂÂÂÂÂÂÂÂ com.sun.jmx.*, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.crypto, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.crypto.spec, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.management, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.management.*, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.naming, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.naming.*, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.net.ssl, \
ÂÂÂÂÂÂÂÂÂÂÂ javax.sql, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.awt, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.beans.editors, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.io, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.management.*, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.misc, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.net, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.net.*, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.nio.*, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.reflect, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.reflect.*, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.rmi.*, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.security.*, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.text, \
ÂÂÂÂÂÂÂÂÂÂÂ sun.text.resources, \
We've omitted the following from the list:
We had hoped to have our bundles use the XML bundles present in our stack.Â We include the Orbit jar javax.xml_1.3.4.v200801282000.jar which exports javax.xml.*, org.w3c.dom.* and the SAX packages.Â When we include this restriction to the classloading, we find our collection of bundles will not start (although Equinox does), be it on J9 or the Sun VM.
For example, we are using PAX Logging bundles which include Log4J.Â Log4J code wants to parse its XML configuration files, yet the bundle it is in does not import any of the XML packages.Â Our thinking is that it is receiving these XML packages implicitly through boot classloader delegation.Â When this restriction is lifted (the default condition) the bundle works fine and is able to start and parse its configuration files.Â In J9, however, we have other bundles that refuse to work when the XML packages are permitted to come from boot classloader delegation.
While we believe this is now a development issue on our part (fix our manifests), do our conclusions hold water?Â Is there something else we ought to try?
Additionally, is there something in the Eclipse IDE we can do to have it warn us when our bundles get their XML goodies from the JRE instead of other bundles?
Are you setting the configuration property
"org.osgi.framework.bootdelegation=*"? What version of Equinox do you
use? Anything version 3.3 or later should not be delegating class loads to the
VM first by default (unless you set explicitly set
org.osgi.framework.bootdelegation=*). If you use Import-Package for some
org.apache.* package and you get resolved to an export from a bundle then you
should load the content of the package from that bundle.
In a nutshell - The J9 VM packages many javax xml extension jars and their corresponding apache implementations in the library directory of the JRE. Many of the same packages are supplied by bundles that ship with Eclipse. A number of these bundles export packages without version numbers, and we find ourselves running into class verification errors when the classes provided by the JRE don't match those expected by the bundles. The Sun JVM prepend the apache classes with com.sun., so the problem is partially mitigated. However, for javax.* classes, the potential for trouble remains.
Is there a way to alter the contents of the system classpath during osgi startup such that we can suppress these additional classes provided by J9 and resolve them from the bundles provided by Eclipse?