2 Replies Latest reply on Aug 6, 2013 3:43 AM by Ampie Barnard

    Activating both Weld-OSGi and the Weld Subsystem in Wildfly 8 Alpha 3

    Ampie Barnard Newbie

      I have checked out the weld-osgi-2.x branch and the latest jbosgi wildfly patch, and I then patched my Wildfly 8 Alpha 3 installation. I had an existing POC which I have now successfully ported to these versions, and it works as it did before. I just had to tweak the bnd file in the weld-osgi-core-mandatory project a bit. Great stuff, I like this product a lot, keep up the good work!

       

      My only concern currently is that I had to deactivate the Weld subsytem in Wildfly, as it kept interfering with Weld-OSGi. I suspect it may have to do with the way I have my capabilities configured in JBoss OSGi, which is as follows:





      <capability name="javax.jws.api" />




      <capability name="javax.interceptor.api" />




      <capability name="javax.persistence.api" />




      <capability name="javax.servlet.api" />




      <capability name="javax.transaction.api" />









      <capability name="org.apache.felix.log" startlevel="1" />




      <capability name="org.jboss.osgi.logging" startlevel="1" />




      <capability name="org.apache.felix.configadmin" startlevel="1" />




      <capability name="org.jboss.as.osgi.configadmin" startlevel="1" />




      <capability name="org.jboss.as.osgi.http" startlevel="1" />




      <capability name="org.jboss.as.osgi.jpa" startlevel="1" />




      <capability name="org.jboss.weld.osgi:weld-osgi-core-mandatory:2.1-SNAPSHOT" startlevel="1" />




      <capability name="org.jboss.weld.osgi:weld-osgi-core-api:2.1-SNAPSHOT" startlevel="2" />




      <capability name="org.jboss.weld.osgi:weld-osgi-core-extension:2.1-SNAPSHOT" startlevel="3" />




      <capability name="org.jboss.weld.osgi:weld-osgi-core-integration:2.1-SNAPSHOT" startlevel="2" />




      <capability name="org.jboss.weld.osgi:weld-osgi-core-spi:2.1-SNAPSHOT" startlevel="2" />

       

      To me this seemed a bit like a sledge hammer approach, because almost all of the classes in weld-osgi-core-mandatory,weld-osgi-core-api and weld-osgi-core-spi are already available as modules, and I have updated the modules to the correct version of Weld. So when I activate the Weld subsystem, it complains about the hibernate validator not implementing Extension which indicates that it has been loaded from a different classloader, in this case the OSGi bundle's own class loader. This therefore does not seem like the correct approach.

       

      What is the correct way of activating Weld-OSGi on top of JBoss OSGi? Is there a way around the conflict with the Wildfly Weld subsystem? If it is simply a case of figuring out how to package the weld-osgi bundles  for Wildfly, maybe I can help, submit a patch or something. But I suspect it may be more than just that?

       

      Any input would be much appreciated!

       

      Ampie

        • 1. Re: Activating both Weld-OSGi and the Weld Subsystem in Wildfly 8 Alpha 3
          Thomas Diesler Master

          all of the classes in weld-osgi-core-mandatory,weld-osgi-core-api and weld-osgi-core-spi are already available as modules

           

          weld-osgi needs to link to the weld modules and not duplicate its packages.

           

          It seems that weld-core does not expose OSGi metadata

           

          Manifest-Version: 1.0

          Archiver-Version: Plexus Archiver

          Created-By: Apache Maven

          Built-By: jharting

          Build-Jdk: 1.7.0_25

          Implementation-Title: Weld Implementation (Core)

          Implementation-URL: http://www.seamframework.org/Weld

          Implementation-Vendor: Seam Framework

          Implementation-Version: 2013-07-17 09:29

          Specification-Title: Weld Implementation (Core)

          Specification-Vendor: Seam Framework

          Specification-Version: 2.0.3.Final

           

           

          Name: Build-Information

          Maven-Version: 3.0.4

          Build-Time: 2013-07-17 09:29

          Os-Name: Linux

          Java-Version: 1.7.0_25

          Java-Vendor: Oracle Corporation

          Os-Version: 3.7.3-101.fc17.x86_64

          Os-Arch: amd64

          SCM: a13ada4d0e679b856bc9c8d0415e2759e9deb0ff

           

          in which case you would probabaly file a jira with the weld folks to do that (i.e. ship their jars as bundles). Meanwhile you can use jbosgi-xservice.properties like we do for javax.persistence

          You would then add the weld modules as capability and check the debug log to verify that they export the packages to the osgi layer that weld-osgi needs.