[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] ClassLoader Issue - org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader versus org.eclipse.core.runtime.internal.adaptor.ContextFinder

I am developing plug-ins for an application that is written on top of the Eclipse framework.  I am seeing different behavior in class loading when I am running the application through the Eclipse dev environment, and when I run it stand alone.  Within Eclipse, when the plug-in uses the JAXP parser, the classes in org.apache.xerces.jaxp are used.  When running stand alone, it appears that the com.sun.org.apache.xerces.internal.jaxp classes are loaded instead.  I tried specifying the DocumentBuilderFactory using the META-INF/services/javax.xml.parsers.DocumentBuilderFactory file.  This file gets picked up when running in Eclipse, but not when the application is running stand alone.

This led me to look into the class loading situation.  I am checking the class loader by calling Thread.currentThread().getContextClassLoader().
When running the application in Eclipse, the loader is org.eclipse.core.runtime.internal.adaptor.ContextFinder.  When running stand alone, the loader is  org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.  So, I am guessing that at some point in time, something is changing the context class loader and maybe I don't see it when I am running in Eclipse because the bundles are loaded in a different order?  If I create a bundle activator, and manually start it from the osgi console, the class loader is still the ContextFinder one, but when the rest of the plugin is called, through the extension point, the class loader has changed.  If I set the Activator to activate when a class from the Bundle is loaded, the class loader at that point has already changed to the DefaultClassLoader one.

Does anyone have any advice to work around this issue?  My main issue is that I cannot troubleshoot it when I am running in Eclipse, because it works fine.

Thanks.

-tj

Tze-John Tang
Discovery Informatics
Global Pharmaceutical Discovery
Abbott
100 Abbott Park Road
Dept. R42T, Building AP10-2
Abbott Park, IL 60064
Phone 847-935-3134
Fax 847-935-0548

tze-john.tang@xxxxxxxxxx



This communication may contain information that is proprietary, confidential, or exempt from disclosure. If you are not the intended recipient, please note that any other dissemination, distribution, use or copying of this communication is strictly prohibited. Anyone who receives this message in error should notify the sender immediately by telephone or by return e-mail and delete it from his or her computer.