[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.birt] BIRT 2.3: Back in classloader hell!

Hi,

I have again a classloader problem with our web application using BIRT after upgrading to 2.3:

In the data source plugin we have written, we need to access data from the web application.

We set the classloader as usual like this:

HashMap appContext=birtcfg.getAppContext();
appContext.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,ReportDataAccess.class.getClassLoader());
birtcfg.setAppContext(appContext);


but we are not able to retrieve the data in the plugin. We need to make a typecast from Object to ReportDataAccess that always fails with a NoClassDefFoundError. The ReportDataAccess class is in the web application's class path.


So I began to research what happens in the plugin. There seem to be several classloaders involved:

- The first one seems to be used for instantiating classes or type casting within the plugin:

org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@14b1fda
parent: org.eclipse.osgi.baseadaptor.BaseAdaptor$ParentClassLoader@34151f


- The second one is the thread context class loader (which seems to have been set using the APPCONTEXT_CLASSLOADER_KEY) which could find my class:


WebappClassLoader
parent: org.apache.catalina.loader.StandardClassLoader@3dc0bb


So, why is the thread context class loader not used for the type cast, but the "wrong" osgi classloader?


I'm really stuck now, I've no idea what to try next...