Strange interaction with Axis & OSGi

Here is the scenario:

I have 2 bundles with the 1.4 axis, and they have built-in transitive dependencies (each of them accesses a different web service to do its job).

It seems that when one loads before the other, the other package β€œloses” with this exception:

java.lang.RuntimeException: java.lang.ClassCastException: org.apache.axis.transport.http.HTTPSender cannot be cast to org.apache.axis.Handler 

I dug up the axis code a bit, and it looks like it actually does some class loading, which is not jive with OSGi (stuff like Class.forName), but since the axis is built into both packages (and each kit has its own class loader). I do not understand why they will be a problem.

Here is another exception:

 Caused by: java.lang.ClassCastException: org.apache.axis.transport.http.HTTPSender cannot be cast to org.apache.axis.Handler at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:216) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.mycompany.myappname.webserviceclient.MyAppNameWebservicePortBindingStub.getAllSiteInformations(MyAppNameWebservicePortBindingStub.java:1603) at com.mycompany.myappname.webserviceclient.MyAppNameWebserviceProxy.getAllSiteInformations(MyAppNameWebserviceProxy.java:164) at com.mycompany.application.myappnamedisplay.view.MetadataTreeCompositeHolder.buildMetadataTree(MetadataTreeCompositeHolder.java:102) ... 51 more Caused by: java.lang.ClassCastException: org.apache.axis.transport.http.HTTPSender cannot be cast to org.apache.axis.Handler at org.apache.axis.deployment.wsdd.WSDDTargetedChain.makeNewInstance(WSDDTargetedChain.java:157) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260) at org.apache.axis.deployment.wsdd.WSDDDeployment.getTransport(WSDDDeployment.java:410) at org.apache.axis.configuration.FileProvider.getTransport(FileProvider.java:257) at org.apache.axis.AxisEngine.getTransport(AxisEngine.java:332) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:163) ... 59 more 

I looked for it quite a bit, and I can not find anything - I almost expect to get another badge here, but again, maybe someone has an idea what is going on here?

Thanks in advance.

+4
source share
1 answer

It seems that from the comments that embedding jars in bundles will not work. We were able to get Axis 1.4 to work as a package by changing some of the Axis 1.4 source code through this post: http://issues.ops4j.org/browse/PAXLOGGING-58

We also took MANIFEST.MF from the springsource axis and simply placed it in the recently compiled Axis JAR. We did this instead of launching it through BND and trying to configure all the optional dependencies. http://nl.interface21.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.axis&version=1.4.0

(Note: We do not use Pax Logging, but instead use the Sling logger, and the changes described above are great for us. They capture how Axis gets Logger from a shared database compatible with the card, which seems to violate Axis 1.4 on OSGi.)

The environment we use is: Day CQ 5.3.0, the Felix OSGi container.

+3
source

Source: https://habr.com/ru/post/1333847/


All Articles