LinkageError in CAF Application calling WebService

I have upgraded MWS from 9.5 to 9.12 and have problems calling WebService from CAF project. The exception is:

The javax.xml.bind.JAXBContext which seems to be duplicated is only present here:

  1. softwareag\jvm\jvm\jre\lib\rt.jar
  2. softwareag\common\lib\glassfish\gf.jaxb-api.jar
  3. softwareag\common\runtime\bundles\ext\eclipse\plugins\com.softwareag.ext.gf.javax.xml.bind_2.2.6.0000-0006.jar

and is not present inside my WAR file. Is there any way to force MWS to use classes from one classloader or to exclude plugin (I tried to delete JAXBContext class from com.softwareag.ext.gf.javax.xml.bind_2.2.6.0000-0006.jar but it ended in MWS not starting at all).

Thank you for your help.

You may include a OSGI-OPT/bnd.bnd file inside your CAF application with more specific instructions for the generation of the OSGi manifest, but that can be tricky to get correct.

Can you provide a simple test project that demonstrates the problem?

If so, then the best course of action would be to request a formal review through the official support channels.

You may want to file an SI (Support Incident) with GS (Global Support). Please include all the necessary information so that GS may record and also review for any other issues that match. If GS needs to create a bug report , then whichever R&D engineer handles this case will be expecting a clear description of the issue, logs and any other details in order to efficiently be able to help. Providing this info in the beginning will make the process go faster.

Thank you for your answer.

How can I tell MWS (in bnd.bnd) not to use bundle softwareag\common\runtime\bundles\ext\eclipse\plugins\com.softwareag.ext.gf.javax.xml.bind_2.2.6.0000-0006.jar ? I found in OSGI console that javax.xml.bind comes from this bundle (and I want it to come from one source: rt.jar)

From the OSGi console, you can verify that there are actually more than one version exported with the packages command like this:

osgi> packages javax.xml.bind

If the package is actually being exported from more than one place, then in theory, you could specify a version range on the Import-Package instruction of specific packages to match a specific exported version.

For example, in your WebContent/OSGI-OPT/bnd.bnd file the content could look something like this to match one whose exported version number is between 0.0 and 1.0:

# adjust some package imports that are used at runtime
Import-Package: javax.xml.bind;version="[0.0,1.0)",\
*

But, I can’t guarantee that it would work as there could be some other bundle in your BundleWiring solution that is wired to the other version which could produce an inconsistent class space and fail.

[quote=Eric Norman]
You may include a OSGI-OPT/bnd.bnd file inside your CAF application with more specific instructions for the generation of the OSGi manifest, but that can be tricky to get correct.

Hello Eric,

Thank for help.

Here is an example CAF project, which calls internet weather service on buton pressing.
And fails badly - with error as citated - when used.
JaxwsPortletProject.zip (3.34 MB)

After a quick look at your sample project, it looks like the simplest solution would be to remove the private copy of these jars from your project:

  • JaxwsPortletProject/WebContent/WEB-INF/lib/jaxb-core.jar
  • JaxwsPortletProject/WebContent/WEB-INF/lib/jaxb-impl.jar
  • JaxwsPortletProject/WebContent/WEB-INF/lib/jaxrpc.jar
  • JaxwsPortletProject/WebContent/WEB-INF/lib/jaxws-rt.jar

The MWS platform already provides jaxb/jaxws libraries for you so you don’t need to include them inside of your CAF application.

Hi Eric,
We tried removing our libs at the beginning, but it coused another problem: Calling Service “do not have a property of name …”
I found similar problem here:

and solution there was to add jax-ws-rt lib into application …
Regards,
Marcin Mulawa

Eric,

we tried it with example bnd.bnd file, but only first deployment succeed.
Next deployments of this project didn’t succeed - with error:

“org.apache.axis2.AxisFault: com.webmethods.portal.bizPolicy.BizException: [POP.003.0139] Component “DamianProject.war” installation failed. System state is recovered by uninstalling the component. Original error: BundleContext is no longer valid
com.webmethods.portal.bizPolicy.BizException: [POP.003.0139] Component “DamianProject.war” installation failed. System state is recovered by uninstalling the component. Original error: BundleContext is no longer valid”

And we cannot even force proper deployment of the original project.
BTW. javax.xml.bind version we needed was 2.2.10

------------EDITED----------------------------------------
OK. Case resolved.

  1. Proper redeploy - after remowing not only bnd.bnd file, but also whole OSGI folder from project. (when bnd file has wrong parameters inside)
  2. Colleaque found a solution - in the file libraries unwanted have to be excluded - by ! sign at the line beginning, like
    !javax.xml.bind; version=“2.2.6”,\