与Axis&的奇怪互动OSGi [英] strange interaction with Axis & OSGi

查看:135
本文介绍了与Axis&的奇怪互动OSGi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是场景:

我有2个轴为1.4的捆绑包,并且其中嵌入了可传递依赖项(它们每个都调用不同的Web服务来完成其工作).

I have 2 bundles with axis 1.4 and it's transitive dependencies embedded in them (they each call a different web service to do their work).

似乎当一个加载在另一个之前时,另一个束丢失",但有以下例外:

It seems that when one loads before the other, the other bundle "loses" with this exception:

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

我已经对轴代码进行了一些挖掘,看来它实际上是在进行一些类加载,但并不与OSGi(Class.forName类型的东西)配合,而是因为轴嵌入在两个捆绑包(以及每个捆绑包)中有它自己的类加载器)我不明白为什么它们会造成问题.

I've dug through the axis code a bit and it looks like it is in fact doing some classloading that doesn't jive with OSGi (Class.forName type stuff) but since axis is embedded in both bundles (and each bundle has it's own classloader) I don't see why their would be a problem.

更多是例外:

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

我已经在Google上搜索了很多,但似乎找不到任何东西-我几乎希望在这里再获得一个风滚草徽章,但是也许有人再次知道这里发生了什么?

I've googled this quite a bit and I can't seem to find anything - I almost expect to get another tumbleweed badge here, but then again maybe someone has an idea what's going on here?

谢谢.

推荐答案

从注释看来,将jar放入捆绑包中无法正常工作.通过这篇文章,我们可以通过更改一些Axis 1.4源代码来使Axis 1.4成为捆绑软件:

It looks like from the comments that embedding the jar in the bundles isn't going to work. We were able to get Axis 1.4 to work as a bundle by changing some of the Axis 1.4 source code via this post: http://issues.ops4j.org/browse/PAXLOGGING-58

我们还从springsource Axis中获取了MANIFEST.MF,并将其放入了新编译的Axis JAR中.我们这样做不是通过BND运行它,而是尝试配置所有可选依赖项. http ://nl.interface21.com/repository/app/bundle/version/detail?name = com.springsource.org.apache.axis& version = 1.4.0

We also took the MANIFEST.MF from the springsource Axis and just drop it into the newly compiled Axis JAR. We did this instead of running 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

(注意:我们不使用Pax日志记录,而是使用Sling记录器,上面的更改对我们来说很好用.它们修复了Axis如何从commons-logging兼容框架中获取Logger的方法,这似乎是在破坏Axis OSGi中为1.4.)

(Note: We don't use Pax Logging but instead use the Sling logger and the changes above work fine for us. They fix how Axis gets the Logger from the commons-logging compatible framework, which is what seems to break Axis 1.4 in OSGi.)

我们正在使用的环境:Day CQ 5.3.0,Felix OSGi容器.

Environment we're using: Day CQ 5.3.0, Felix OSGi container.

这篇关于与Axis&的奇怪互动OSGi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆