Question

I've been tasked with updating a plugin for Cytoscape, a biological visualization software platform, to the latest version of the Cytoscape API. Cytoscape 3.x uses an OSGI framework (Karaf 2.2.x, I think) to interface with its plugins (which are now called "apps").

The plugin/app is actually a client that uses JAX-WS to communicate with an external server. But for some reason, despite the absence of any error messages, it fails to unmarshal the SOAP messages that it's getting. The desired objects are created with the default constructor, but their fields remain empty.

I can confirm that the XML does arrive from the server in one piece. I can also confirm that this same code works in a non-OSGI environment. Furthermore, enabling the jaxb.debug JVM option for both the OSGI and non-OSGI versions shows that JAXB appears to be doing the exact same things behind the scenes in both cases.

So, I have no idea what's going on here. Any ideas?

Update:

After further investigation, I've determined that the problem may not have anything directly to do with JAX-WS at all. I saved the SOAP message that arrives from the web service as an XML file on my hard drive. Attempting to directly unmarshal it, without touching the web service at all, caused this:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: javax.xml.stream.XMLInputFactory.newFactory()Ljavax/xml/stream/XMLInputFactory;

Once again, this same code works fine in a standalone non-OSGI environment. Very strange.

Was it helpful?

Solution 2

I think I've found a solution.

I added the Apache ServiceMix Stax API 1.2 bundle to the Cytoscape OSGI container, and then used Import-Package to import its javax.xml.stream package into my own bundle, making sure to require version 1.2 and up.

It seems that Cytoscape by default provides an out of date (Java 5?) version of javax.xml.stream.XMLInputFactory, and that this was the source of all my problems. It didn't actually make my manual unmarshalling code work (there were still some weird API/implementation version mismatches that threw exceptions) but the original web service code did.

OTHER TIPS

The built in jaxws support of the jdk is not compatible to OSGi.

You could try to install Apache CXF on karaf. There is a karaf feature for it. So installation is pretty simple. See http://liquid-reality.de/display/liquid/2011/12/22/Karaf+Tutorial+Part+4+-+CXF+Services+in+OSGi

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top