Hi,

I am trying to use CXF and WSS4J to provide secure web services in a Felix 
environment.
When doing this I have run into a couple of problems.

I am using the cxf-minimal-bundle which needs javax.xml.ws.spi that I've 
provide through the geronimo-jaxws_2.1_spec bundle. These packages are using 
the service provider, META-INF/services pattern to load the correct 
implementation of javax.xml.ws.spi.Provider (which should be supplied by the 
cxf bundle). This doesn't work well with OSGi. Since the two bundles have 
different classloaders it falls back on the default alternative (which is 
org.apache.axis2.jaxws.spi.Provider, i.e. not what I want).

I've tried to find a solution for this problem without success. I've noticed 
that other people have experience similar problems but haven't found a solution 
that lets me use the third party bundles without any modification?

I tried to solve the problem by using the Embed-Dependency instruction to the 
maven bundle plugin. I've successfully embedded the bundles, but I can't figure 
out how to make the META-INF/services visible to the other bundle. I figured 
that putting them in the same bundles would make their resources visible to the 
bundle classloader. But when the FactoryFinder is trying to find the 
appropriate implementation I get the following error (the same as before I've 
bundled the jaxws implementation inside my bundle) :

DEBUG: META-INF/services/javax.xml.ws.spi.Provider 
(org.apache.felix.moduleloader.ResourceNotFoundException: 
META-INF/services/javax.xml.ws.spi.Provider)

This is the instructions I give to the bundle plugin.

<plugins>
  <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <configuration>
      <instructions>
        <Private-Package>foo.impl.ws.*</Private-Package>
        <Bundle-Activator>foo.impl.ws.Activator</Bundle-Activator>
        <Import-Package>*;resolution:=optional</Import-Package>
        <Export-Package>
          org.apache.cxf*;-split-package:=merge-first,
          javax.xml.ws*;-split-package:=merge-first,
          org.springframework*;-split-package:=merge-first
        </Export-Package>
        <Embed-Dependency>
          cxf-bundle-minimal;inline=META-INF/**/*,
          geronimo-jaxws_2.1_spec;inline=META-INF/**/*,
          org.apache.servicemix.specs.jaxws-api-2.1;inline=META-INF/**/*,
          spring-*;inline=META-INF/**/*
        </Embed-Dependency>
        <Embed-Transitive>false</Embed-Transitive>
      </instructions>
    </configuration>
  </plugin>

I'm open to all kinds of suggestions on how to tackle this problem.
I managed to get around the problem above my manually specifying which 
implementation to use in system.properties, but then I experienced similar 
problems with some of the spring packages hence those are included in the 
example above tool.
I really feel that it should be possible to embed the dependencies inside my 
bundle to unify the classpath/loader.

BR,
Jacob

Reply via email to