OSGI - Unable to deploy Eclipse Gemini Extender

61 views
Skip to first unread message

etmag...@gmail.com

unread,
Aug 4, 2016, 12:24:59 AM8/4/16
to dotCMS User Group
Hi, 

I'm trying to deploy Eclipse Gemini Extender. Managed to load all other dependent OSGi bundles but hit a ClassCastException when Felix tries to invoke the Activator

Here's the stack trace on the console output


Error while starting bundle: file:/C:/Java/dotcms_3.5/dotserver/tomcat-8.0.18/webapps/ROOT/WEB-INF/felix/load/gemini-blueprint-extender-2.0.0.RELEASE.jar: com.dotcms.repackage.org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.gemini.blueprint.extender [22].ERROR: Bundle org.eclipse.gemini.blueprint.extender [22] Error starting/stopping bundle. (com.dotcms.repackage.org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.gemini.blueprint.extender [22].) com.dotcms.repackage.org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.gemini.blueprint.extender [22].java.lang.ClassCastException: org.eclipse.gemini.blueprint.extender.internal.boot.ChainActivator cannot be cast to com.dotcms.repackage.org.osgi.framework.BundleActivator
        at com.dotcms.repackage.org.apache.felix.framework.Felix.activateBundle(Felix.java:2196)
        at com.dotcms.repackage.org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4336)
        at com.dotcms.repackage.org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
        at com.dotcms.repackage.org.apache.felix.framework.Felix.activateBundle(Felix.java:2141)
        at com.dotcms.repackage.org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
        at com.dotcms.repackage.org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
        at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1175)
        at com.dotcms.repackage.org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1483)
        at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1153)
        at com.dotcms.repackage.org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:334)
        at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.processAllBundles(DirectoryWatcher.java:1146)
        at java.lang.Thread.run(Thread.java:745)
        at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:456)
        at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)
Caused by: java.lang.ClassCastException: org.eclipse.gemini.blueprint.extender.internal.boot.ChainActivator cannot be cast to com.dotcms.repackage.org.osgi.framework.BundleActivator
        at com.dotcms.repackage.org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4336)
        at com.dotcms.repackage.org.apache.felix.framework.Felix.activateBundle(Felix.java:2141)
        ... 7 more


Noticed that Felix is repackaged as well. How should I go about it?

Thanks.

Jason Tesser

unread,
Aug 4, 2016, 9:02:36 AM8/4/16
to dotCMS User Group
You would need to use JARJAR or some other tool to repackage as we do to add this 

My recommendation would be to not mess with our OSGi implementation if you do not need to 

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/d2184bbb-1cf5-46a8-8ec5-98fc20e39483%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cornelius Kee

unread,
Aug 5, 2016, 12:33:29 AM8/5/16
to dot...@googlegroups.com
Hi Jason, 

We've got an existing classic plugin on dotCMS 2.5, thought it would be a good time to move to OSGi during the upgrade to 3.5. The previous plugin relied heavily on spring, but on moving to OSGi, I came across Spring Dynamic Module which is now Eclipse Gemini Blueprint, which has a bundle that listens for spring-aware bundle. Hence the exception that I posted previously. Failing that I tried to just instantiate the ClassPathXMLApplicationContext in the Activator, that's when start having issues with not being able to locate the xml because it looks into the web app classloader instead of the bundle's classloader. The bundle was extended from the custom.spring example. Any idea on how to resolve this?

Thanks.

 

You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/OMlNXVK4bgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dotcms+un...@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

etmag...@gmail.com

unread,
Aug 9, 2016, 12:39:04 AM8/9/16
to dotCMS User Group
Hi All,


Here's the latest update. I managed to initialize my spring's ApplicationContext by messing with which classloader it's to use.


            // Create a parent ApplicationContext which would hold reference to the
            // connection pool defined as a tomcat resource.
            GenericApplicationContext datasourceApplicationContext = new GenericApplicationContext();
            datasourceApplicationContext.refresh();
            datasourceApplicationContext.getBeanFactory().registerSingleton("dbDataSource", new InitialContext().lookup("java:comp/env/jdbc/myPool"));

            // initialize second ApplicationContext using the bundle's classloader
            // this would be the ApplicationContext that we'd be referencing 
            // throughout the bundle
            ClassPathResource resource = new ClassPathResource("META-INF/spring/spring.xml", this.getClass().getClassLoader());
            GenericApplicationContext applicationContext = new GenericApplicationContext(datasourceApplicationContext);
            applicationContext.setClassLoader(this.getClass().getClassLoader());
            XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
            reader.loadBeanDefinitions(resource);
            applicationContext.getBeanFactory().setBeanClassLoader(this.getClass().getClassLoader());
            applicationContext.refresh();
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/d2184bbb-1cf5-46a8-8ec5-98fc20e39483%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/OMlNXVK4bgM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages