11 Replies Latest reply on Aug 24, 2012 11:24 AM by smithleej

    Bundle not started correctly when blueprint XML depends on CXF namespace

    smithleej

      I have been looking into OSGi on JBoss 7 using bundles that rely on blueprint to wire the services of the bundles together.  I have had some success with the release of 7.1.0.Final thanks to the replies to my previous post https://community.jboss.org/thread/175431.  I have now upgraded to JBoss 7.1.1.Final and I am now having an issue when i add CXF into the equation.  I have an API bundle and a core services bundle that depends on the API bundle.  In the core bundle I have modified the working blueprint XML by including the CXF namespace that would allow me to modify the CXF bus.  The new blueprint XML now looks like the following with the CXF namespace and CXF bus configuration:

       

      {code:xml}

      <?xml version="1.0" encoding="UTF-8"?>

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                 xmlns:cxf="http://cxf.apache.org/blueprint/core"

                 xsi:schemaLocation="

                   http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

             http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd"

                 default-activation="eager">

       

          <cxf:bus>

              <cxf:features>

                  <cxf:logging />

              </cxf:features>

              <cxf:properties>

                  <entry key="schema-validation-enabled" value="true" />

                  <entry key="mtom-enabled" value="true" />

              </cxf:properties>

              <cxf:outInterceptors>

                  <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">

                      <!--<argument ref="wsSecurityConfig" />-->

                  </bean>

              </cxf:outInterceptors>

          </cxf:bus>

       

          <!-- declare our veryUsefulService bean as an OSGi service -->

          <service ref="veryUsefulService" interface="com.efstech.demo.osgi.core.services.VeryUsefulService"/>

       

          <!-- setup our bundle activator -->

          <bean id="coreServicesActivator" class="com.efstech.demo.osgi.core.CoreServicesActivator" init-method="start" destroy-method="stop"/>

       

          <!-- create our VeryUsefulService as a bean so we can use to for the OSGi service-->

          <bean id="veryUsefulService" class="com.efstech.demo.osgi.core.services.VeryUsefulServiceImpl"/>

       

      </blueprint>

      {code}

       

      I have also enabled blueprint and added the CXF module as a dependency with the following OSGi subsytem configuration in the standalone.xml:

       

      {code:xml}

      <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="eager">

                  <properties>

                      <property name="org.jboss.osgi.system.modules.extra">

                          org.apache.log4j,org.apache.cxf

                      </property>

                      <property name="org.osgi.framework.startlevel.beginning">

                          3

                      </property>

                      <property name="org.osgi.framework.system.packages.extra">

                          org.apache.log4j;version=1.2

                      </property>

                  </properties>

                  <capabilities>

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

                      <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.apache.aries:org.apache.aries.util:0.4" startlevel="2"/>

                      <capability name="org.apache.aries.proxy:org.apache.aries.proxy:0.4" startlevel="2"/>

                      <capability name="org.apache.aries.blueprint:org.apache.aries.blueprint:0.4" startlevel="2"/>

                      <capability name="org.apache.cxf" startlevel="3"/>

                  </capabilities>

              </subsystem>

      {code}

       

      Now when i deploy my API bundle followed by my core bundle I see this logging:

       

      {code}

      2012-06-20 10:53:06 DEBUG [org.jboss.as.osgi] (MSC service thread 1-6) Add module spec to loader: deployment.core:1.0.0.SNAPSHOT

      2012-06-20 10:53:06 DEBUG [org.jboss.modules] (MSC service thread 1-6) Module deployment.core:1.0.0.SNAPSHOT defined by Service Module Loader

      2012-06-20 10:53:06 DEBUG [org.jboss.osgi.framework.internal.AbstractBundleService] (MSC service thread 1-21) Starting: service jbosgi.bundle.13.core."1.0.0.SNAPSHOT".RESOLVED in mode ACTIVE

      2012-06-20 10:53:06 DEBUG [org.apache.aries.blueprint.container.BlueprintExtender] (MSC service thread 1-6) Scanning bundle core for blueprint application

      2012-06-20 10:53:06 DEBUG [org.apache.aries.blueprint.container.BlueprintExtender] (MSC service thread 1-6) Found blueprint application in bundle core with paths: [bundle://core-13-0-0/OSGI-INF/blueprint/blueprint.xml]

      2012-06-20 10:53:06 DEBUG [org.apache.aries.blueprint.container.BlueprintExtender] (MSC service thread 1-6) Scheduling creation of blueprint bundle core asynchronously

      2012-06-20 10:53:06 DEBUG [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 1) Running blueprint container for bundle core in state Unknown

      2012-06-20 10:53:06 DEBUG [org.jboss.osgi.framework.internal.AbstractBundleService] (MSC service thread 1-20) Starting: service jbosgi.bundle.13.core."1.0.0.SNAPSHOT".ACTIVE in mode ACTIVE

      2012-06-20 10:53:06 INFO  [org.jboss.osgi.framework.internal.HostBundleState] (MSC service thread 1-6) Bundle started: core:1.0.0.SNAPSHOT

      2012-06-20 10:53:06 DEBUG [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 1) Sending blueprint container event BlueprintEvent[type=CREATING] for bundle core

      2012-06-20 10:53:06 INFO  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 1) Bundle core is waiting for namespace handlers [http://cxf.apache.org/blueprint/core]

      2012-06-20 10:53:06 DEBUG [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 1) Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD, dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://cxf.apache.org/blueprint/core))]] for bundle core

      2012-06-20 10:53:06 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "core-1.0-SNAPSHOT.jar"

      {code}

       

      When I remove the CXF namespace and bus configuration from the blueprint XML of the core bundle and redeploy I get the following logging i.e. the service is registered in OSGi:

       

      {code}

      2012-06-20 11:20:43 DEBUG [org.jboss.as.osgi] (MSC service thread 1-4) Add module spec to loader: deployment.core:1.0.0.SNAPSHOT

      2012-06-20 11:20:43 DEBUG [org.jboss.modules] (MSC service thread 1-4) Module deployment.core:1.0.0.SNAPSHOT defined by Service Module Loader

      2012-06-20 11:20:43 DEBUG [org.jboss.osgi.framework.internal.AbstractBundleService] (MSC service thread 1-2) Starting: service jbosgi.bundle.13.core."1.0.0.SNAPSHOT".RESOLVED in mode ACTIVE

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintExtender] (MSC service thread 1-4) Scanning bundle core for blueprint application

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintExtender] (MSC service thread 1-4) Found blueprint application in bundle core with paths: [bundle://core-13-0-0/OSGI-INF/blueprint/blueprint.xml]

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintExtender] (MSC service thread 1-4) Scheduling creation of blueprint bundle core asynchronously

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Running blueprint container for bundle core in state Unknown

      2012-06-20 11:20:43 DEBUG [org.jboss.osgi.framework.internal.AbstractBundleService] (MSC service thread 1-16) Starting: service jbosgi.bundle.13.core."1.0.0.SNAPSHOT".ACTIVE in mode ACTIVE

      2012-06-20 11:20:43 INFO  [org.jboss.osgi.framework.internal.HostBundleState] (MSC service thread 1-4) Bundle started: core:1.0.0.SNAPSHOT

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 3) Sending blueprint container event BlueprintEvent[type=CREATING] for bundle core

      2012-06-20 11:20:43 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "core-1.0-SNAPSHOT.jar"

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Tracking service references: []

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Registering service .component-1 with interfaces [com.efstech.demo.osgi.core.services.VeryUsefulService] and properties {osgi.service.blueprint.compname=veryUsefulService}

      2012-06-20 11:20:43 DEBUG [org.jboss.osgi.framework.internal.ServiceManagerPlugin] (Blueprint Extender: 3) Register service: ServiceState{service.id=28, osgi.service.blueprint.compname=veryUsefulService, objectClass=[com.efstech.demo.osgi.core.services.VeryUsefulService]}

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Instantiating components: [blueprintContainer, blueprintBundle, blueprintBundleContext, blueprintConverter, .component-1, coreServicesActivator, veryUsefulService]

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Retrieving service for bundle null and service registration null

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Creating service instance

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Service created: com.efstech.demo.osgi.core.services.VeryUsefulServiceImpl@199ec67

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Creating listeners

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Listeners created: []

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 3) Calling listeners for initial service registration

      2012-06-20 11:20:43 INFO  [com.efstech.demo.osgi.core.CoreServicesActivator] (Blueprint Extender: 3) Started Core Services Bundle

      2012-06-20 11:20:43 DEBUG [org.jboss.osgi.framework.internal.ServiceManagerPlugin] (Blueprint Extender: 3) Register service: ServiceState{service.id=29, objectClass=[org.osgi.service.blueprint.container.BlueprintContainer], osgi.blueprint.container.version=1.0.0.SNAPSHOT, osgi.blueprint.container.symbolicname=core}

      2012-06-20 11:20:43 DEBUG [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 3) Sending blueprint container event BlueprintEvent[type=CREATED] for bundle core

      {code}

       

      So the presence of the CXF namespace appears to stop the beans in the core blueprint XML from being created and the services from being registered, suggested by the logging: Bundle core is waiting for namespace handlers [http://cxf.apache.org/blueprint/core]

       

      I have checked the CXF jar (cxf-rt-core-2.4.6.jar, found under JBOSS_HOME/modules/org/apache/cxf/main) which contains that CXF namespace, and it contains a cxf-core.xml under OSGI-INF/blueprint that from what I understand should make the namespace "http://cxf.apache.org/blueprint/core" available.

       

      I wonder if I am missing some configuration to make this namespace available to my bundle, or if maybe it won't work due to the way I am including the CXF module as an OSGi bundle in the standalone.xml configuration.

       

      Any help would be greatly appreciated.  I will attach the updated source and binaries that I am using.

        • 1. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
          thomas.diesler

          I guess you would first want to verify that CXF/Blueprint works in the context of a plain OSGi Framework. If it works on Felix/Equinox it should work on the our framework too. It then should also work in the context of AS7.

           

          You could fork git://github.com/jbosgi/jbosgi.git. Write a little test case and run it like this:

           

          mvn -Dframework=[felix|equinox] -Dtest=YourCXFBlueprintTestCase test

          • 2. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
            smithleej

            I tried to modify the existing BlueprintTestCase without success, I added the CXF namespace to the blueprint-example.xml, added the CXF bundle as a dependency to the pom.xml and modified the assembly-bundles.xml so that the cxf-bundle.jar was added to the test-lib/bundles directory when the test was run but it didn't work.  This is could be down to me not having any previous experience with Arquilian.

             

            I have downloaded Apache Karaf (using Felix) and installed CXF (based on the instructions in this tutorial: http://www.liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi) and the bundles start and publish/subscribe services as expected.  I understand the CXF distribution they use has had all of it's dependencies tailored to the Karaf environment (as it is installed from the following maven repository location org.apache.cxf.karaf/apache-cxf/2.5.1).  So I am wondering if it just a case of the CXF distribution that comes with JBoss not being compatible with being used in an OSGi environment?

            • 3. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
              thomas.diesler

              > This is could be down to me not having any previous experience with Arquilian

               

              Don't worry I can help with this. Whats the stack trace? What does the log say?

               

              > So I am wondering if it just a case of the CXF distribution that comes with JBoss not being compatible with being used in an OSGi environment?

               

              Possibly. When a functionality is not covered by the testsuite(s) you can assume that it is not there or may fail.

               

              Lets work on that standalone test first.

              • 4. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                smithleej

                Thanks for the offer, but I've now got the test failing in a way i would expect:

                 

                {code}

                16:06:15,340 INFO  [org.jboss.osgi.framework] (main) JBOSGI011002: Bundle started: jbosgi-jmx:1.1.0.Final

                16:06:15,341 DEBUG [org.jboss.osgi.framework] (main) Starting bundle: example-blueprint:0.0.0

                16:06:15,342 FINE  [org.apache.aries.blueprint.container.BlueprintExtender] (main) Scanning bundle example-blueprint for blueprint application

                16:06:15,343 FINE  [org.apache.aries.blueprint.container.BlueprintExtender] (main) Found blueprint application in bundle example-blueprint with paths: [bundle://example.blueprint-14-0-0/OSGI-INF/blueprint/blueprint-example.xml]

                16:06:15,343 FINE  [org.apache.aries.blueprint.container.BlueprintExtender] (main) Scheduling creation of blueprint bundle example-blueprint asynchronously

                16:06:15,343 INFO  [org.jboss.osgi.framework] (main) JBOSGI011002: Bundle started: example-blueprint:0.0.0

                16:06:15,343 FINE  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Running blueprint container for bundle example-blueprint in state Unknown

                16:06:15,344 FINE  [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 3) Sending blueprint container event BlueprintEvent[type=CREATING] for bundle example-blueprint

                16:06:15,346 INFO  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Bundle example-blueprint is waiting for namespace handlers [http://cxf.apache.org/blueprint/core]

                16:06:15,346 FINE  [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 3) Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD, dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://cxf.apache.org/blueprint/core))]] for bundle example-blueprint

                16:06:25,154 DEBUG [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (main) Result: TestResult[status=FAILED,time=19255ms]

                16:06:25,155 ERROR [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (main) Failed: org.jboss.test.osgi.example.blueprint.BlueprintTestCase.testBlueprintContainerAvailable: java.lang.AssertionError: BlueprintContainer not null

                    at org.junit.Assert.fail(Assert.java:91)

                    at org.junit.Assert.assertTrue(Assert.java:43)

                    at org.junit.Assert.assertNotNull(Assert.java:524)

                    at org.jboss.test.osgi.example.blueprint.BlueprintTestCase.getBlueprintContainer(BlueprintTestCase.java:134)

                    at org.jboss.test.osgi.example.blueprint.BlueprintTestCase.testBlueprintContainerAvailable(BlueprintTestCase.java:99)

                {code}

                 

                As you can see I am getting the same INFO message as when I am attempting this in JBoss 7.1.1:

                 

                {code}

                16:06:15,346 INFO  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Bundle example-blueprint is waiting for namespace handlers [http://cxf.apache.org/blueprint/core]

                {code}

                 

                Unfortunately I get this whether I supply felix, equinox or nothing (which I assume would be jboss) for -Dframework.

                There must be something that Apache Karaf and Eclipse Virgo do to enable the publishing of custom namespaces through OSGi using:

                 

                {code}

                <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

                           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

                 

                  <service interface="org.apache.aries.blueprint.NamespaceHandler">

                    <service-properties>

                      <entry key="osgi.service.blueprint.namespace" value="http://cxf.apache.org/blueprint/core"/>

                    </service-properties>

                    <bean class="org.apache.cxf.bus.blueprint.CXFCoreNamespaceHandler"/>

                  </service>

                </blueprint>

                {code}

                 

                I am unable to find anything helpful though when I google for 'org.apache.aries.blueprint.NamespaceHandler' etc to indicate how this would work.

                • 5. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                  thomas.diesler

                  How do you provide the namespace handler? I presume there is a set of additional bundles that must be installed/started. Do you see those processed correctly?

                   

                  > As you can see I am getting the same INFO message as when I am attempting this in JBoss 7.1.1

                   

                  Thats good. We can leave AS7 out of the picture for now.

                  • 6. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                    smithleej

                    The namespace handler is provided by the cxf-bundle jar, I had thought the blueprint bundle that is already installed would listen for any service registration of 'org.apache.aries.blueprint.NamespaceHandler' and then publish the namespace for me to consume in my bundle.  Maybe I need to look at the logging I get in Karaf to see if I can see the point when the 'org.apache.aries.blueprint.NamespaceHandler' service is registered and what is done after that.

                    • 7. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                      thomas.diesler

                      What does our log say? How do you install/start that NSH bundle?

                      • 8. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                        smithleej

                        I've attached the log from the jboss/blueprint test.

                        Incidentally I've seen these keys lines of logging in Karaf:

                         

                        {code}

                        2012-06-25 09:48:22,893 | DEBUG | rint Extender: 3 | ServiceRecipe                               | 10 - org.apache.aries.blueprint - 0.3.1 | Registering service .component-1 with interfaces [org.apache.aries.blueprint.NamespaceHandler] and properties {osgi.service.blueprint.namespace=[http://cxf.apache.org/blueprint/core, http://cxf.apache.org/configuration/beans, http://cxf.apache.org/configuration/parameterized-types]}

                        2012-06-25 09:48:22,893 | DEBUG | rint Extender: 3 | NamespaceHandlerRegistryImpl     | 10 - org.apache.aries.blueprint - 0.3.1 | Adding NamespaceHandler [org.apache.aries.blueprint.NamespaceHandler]

                        {code}

                         

                        Which contains the namespace I require.

                         

                        I do see similar logging for the jboss/blueprint test in one place of the test.log which suggests the mechanism is in place:

                         

                        {code}

                        10:37:35,858 FINE  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 2) Tracking service references: [#recipe-3]

                        10:37:35,862 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Registering service .component-2 with interfaces [org.apache.aries.blueprint.NamespaceHandler] and properties {osgi.service.blueprint.namespace=[Ljava.lang.Object;@11e78461}

                        10:37:35,862 DEBUG [org.jboss.osgi.framework] (Blueprint Extender: 2) Register service: ServiceState{service.id=17, objectClass=[org.apache.aries.blueprint.NamespaceHandler], osgi.service.blueprint.namespace=[Ljava.lang.Object;@11e78461}

                        10:37:35,863 FINE  [org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl] (Blueprint Extender: 2) Adding NamespaceHandler ServiceState{service.id=17, objectClass=[org.apache.aries.blueprint.NamespaceHandler], osgi.service.blueprint.namespace=[Ljava.lang.Object;@11e78461}

                        10:37:35,864 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Retrieving service for bundle org.apache.aries.blueprint:0.4.0 and service registration ServiceState{service.id=17, objectClass=[org.apache.aries.blueprint.NamespaceHandler], osgi.service.blueprint.namespace=[Ljava.lang.Object;@11e78461}

                        10:37:35,864 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Creating service instance

                        10:37:35,867 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Service created: org.apache.aries.blueprint.ext.ExtNamespaceHandler@33b7b32c

                        10:37:35,867 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Creating listeners

                        10:37:35,867 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Listeners created: []

                        10:37:35,867 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Calling listeners for initial service registration

                        10:37:35,868 FINE  [org.apache.aries.blueprint.container.ServiceRecipe] (Blueprint Extender: 2) Method entry: getService, args org.apache.aries.blueprint.ext.ExtNamespaceHandler@33b7b32c

                        10:37:35,868 FINE  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 2) Instantiating components: [blueprintContainer, blueprintBundle, blueprintBundleContext, blueprintConverter]

                        {code}

                         

                        I can see where the test bundle is being started and is waiting for the namespace:

                         

                        {code}

                        10:37:35,728 DEBUG [org.jboss.osgi.framework] (main) Starting bundle: example-blueprint:0.0.0

                        10:37:35,728 FINE  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 2) Grace-period directive: false

                        10:37:35,728 FINE  [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 2) Sending blueprint container event BlueprintEvent[type=CREATING] for bundle org.apache.aries.blueprint

                        10:37:35,730 FINE  [org.apache.aries.blueprint.container.BlueprintExtender] (main) Scanning bundle example-blueprint for blueprint application

                        10:37:35,731 FINE  [org.apache.aries.blueprint.container.BlueprintExtender] (main) Found blueprint application in bundle example-blueprint with paths: [bundle://example.blueprint-11-0-0/OSGI-INF/blueprint/blueprint-example.xml]

                        10:37:35,731 FINE  [org.apache.aries.blueprint.container.BlueprintExtender] (main) Scheduling creation of blueprint bundle example-blueprint asynchronously

                        10:37:35,732 INFO  [org.jboss.osgi.framework] (main) JBOSGI011002: Bundle started: example-blueprint:0.0.0

                        10:37:35,732 FINE  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Running blueprint container for bundle example-blueprint in state Unknown

                        10:37:35,732 FINE  [org.apache.aries.blueprint.container.BlueprintEventDispatcher] (Blueprint Extender: 3) Sending blueprint container event BlueprintEvent[type=CREATING] for bundle example-blueprint

                        10:37:35,828 INFO  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 3) Bundle example-blueprint is waiting for namespace handlers [http://cxf.apache.org/blueprint/core]

                        {code}

                         

                        But I can also see where the cxf-bundle is waiting for a blueprint namespace, so I wonder if maybe it's own namespace won't be exported until it resolves it's own namespace dependency:

                         

                        {code}

                        10:37:35,828 INFO  [org.apache.aries.blueprint.container.BlueprintContainerImpl] (Blueprint Extender: 1) Bundle org.apache.cxf.bundle is waiting for namespace handlers [http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0]

                        {code}

                        • 9. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                          thomas.diesler

                          Seems to be an Aries Bluieprint issue. Perhaps some debugging is required on why ABP is waiting.

                          • 10. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                            smithleej

                            I finally got a chance to look at this again.  It appears to be down to this issue: https://issues.jboss.org/browse/JBOSGI-408.  This is stopping org.apache.aries.blueprint.container.BlueprintExtender from being able to access the blueprint configuration of the CXF module.  Is there a workaround that you are aware of?

                            • 11. Re: Bundle not started correctly when blueprint XML depends on CXF namespace
                              smithleej

                              I first worked around this issue by including the service that exports the CXF namespace in one of my own bundles. the service being:

                               

                              {code:xml}

                                   <service interface="org.apache.aries.blueprint.NamespaceHandler">

                                      <service-properties>

                                          <entry key="osgi.service.blueprint.namespace">

                                              <list>

                                                  <value>http://cxf.apache.org/blueprint/core</value>

                                                  <value>http://cxf.apache.org/configuration/beans</value>

                                                  <value>http://cxf.apache.org/configuration/parameterized-types</value>

                                              </list>

                                          </entry>

                                      </service-properties>

                                      <bean class="org.apache.cxf.bus.blueprint.CXFCoreNamespaceHandler"/>

                                  </service>

                              {code}

                               

                              This allowed me to use the CXF namespace so I could include the CXF bus configuration in my Blueprint XML

                               

                              {code:xml}

                                   <cxf:bus>

                                      <cxf:features>

                                          <cxf:logging/>

                                      </cxf:features>

                                      <cxf:properties>

                                          <entry key="schema-validation-enabled" value="true"/>

                                          <entry key="mtom-enabled" value="true"/>

                                      </cxf:properties>

                                      <cxf:outInterceptors>

                                          <bean class="com.efstech.demo.osgi.core.cxf.EFSWSS4JOutInterceptor"/>

                                      </cxf:outInterceptors>

                                  </cxf:bus>

                              {code}

                               

                              However this configuration was not picked up because in Blueprint you cannot use the 'import' tag so I couldn't include the following:

                               

                              {code:xml}

                              <import resource="classpath:META-INF/cxf/cxf.xml"/>

                              {code}

                               

                              In the end I just used 'org.apache.cxf.jaxws.JaxWsProxyFactoryBean' to configure and and invoke the web service method.

                               

                              {code}

                              Map<String, Object> map = new HashMap<String, Object>();

                              map.put("schema-validation-enabled", true);

                              map.put("mtom-enabled", true);

                               

                              JaxWsProxyFactoryBean proxy = new JaxWsProxyFactoryBean();

                              proxy.setProperties(map);

                              proxy.setServiceClass(EmailEndpoint.class);

                              proxy.setAddress("http://localhost:8082/pdmwebsvc-v2/email?wsdl");

                              proxy.setUsername("admin");

                              proxy.setPassword("password");

                              proxy.getOutInterceptors().add(new EFSWSS4JOutInterceptor());

                               

                              EmailEndpoint emailEndpoint = (EmailEndpoint) proxy.create();

                              emailEndpoint.send(recipients, from, subject, message);

                              {code}