Hi guys I use weblogic that ships felix to wrap osgi applications in a j2ee webapplication. An example application I found (http://buttso.blogspot.ch/2013/09/weblogic-server-using-osgi-bundles-with.html) works well, I can access a deployed service.
What they do, is quite normal: @Resource(lookup = "java:app/osgi/Bundle") Bundle bundle; BundleContext bc = bundle.getBundleContext(); ServiceReference dictionaryServiceRef = bc.getServiceReference(DictionaryService.class); DictionaryService dictionaryService = (DictionaryService) bc.getService(dictionaryServiceRef); However, when I do this within my wrapped osgi application: activatorBundle.getBundleContext().getService( activatorBundle.getBundleContext().getServiceReference(IExtendedTaskManager.class) ) I do get a get a (com.kuka.task.osgi.TaskManagerComponent) com.kuka.task.osgi.TaskManagerComponent@1575e8f). So far, all perfectly fine. The TaskManagerComponent implements the IExtendedTaskManager. Now, things start to get odd. I now want to cast this to a TaskManagerComponent so that I can start using the methods on it. When I do this, I get: ClassCastException: Cannot cast com.kuka.task.osgi.TaskManagerComponent (id=434) to com.kuka.task.osgi.TaskManagerComponent Since the classnames are identical, I assume to run into a classloader issue. My guess is: My Servlet runs in a weblogic web classloader and the osgi stuff runs in a felix classloader. How can I resolve this issue? The TaskManagerComponent is in one jar only, which is deployed with the wrapper osgi application and the servlet uses the same jar file. Thanks, Remo This message may contain legally privileged or confidential information and is therefore addressed to the named persons only. The recipient should inform the sender and delete this message, if he/she is not named as addressee. The sender disclaims any and all liability for the integrity and punctuality of this message. The sender has activated an automatic virus scanning, but does not guarantee the virus free transmission of this message. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

