سؤال

Fetching a commonj Workmanager from WAS via JNDI isn't a big deal, but my code fails inside a OSGi environment (I am using a bundleActivator, not aries blueprint).

import commonj.work.WorkManager; 
InitialContext ic = new InitialContext();
WorkManager wm = (WorkManager)ic.lookup("java:comp/env/wm/myWorkManager");

This code block works fine inside a WAR. But if i add it to my native OSGi bundle it fails with a ClassCastException.

Inspecting my Object it tells me workManager is an instance of com.ibm.ws.asynchbeans.WorkManagerImpl.

Creating a custom delegator between IBMs WorkManager and CommonJ WorkManager shouldn't be a big deal, but due to my research i wasn't able to find a class hierarchy of IBMs workManager neither than a JAR containing the class.

We use Websphere 8.0.0.6.

WorkManager.class.getClassLoader() = org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@d34707f4

wm.getClass().getClassLoader().loadClass(WorkManager.class.getName()).getClassLoader() = org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@5d968aee

WorkManager.class.getProtectionDomain().getCodeSource().getLocation() = file:/D:/dev/IBM/WebSphere/AppServer/profiles/AppSrv01/installedEBAs/jndi-workmanager_0.0.1.SNAPSHOT/byValue/c13b7c6c-1881-477c-a339-e0c4f992e35b.0/0/

هل كانت مفيدة؟

المحلول

Based on the class source location, it appears you have packaged the commonj.work classes in your bundle. You should remove those to allow them to be loaded from the WebSphere Application Server runtime instead.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top