错误:java.lang.ClassCastException:类org.apache.cxf.bus.spring.SpringBusFactory

发布于 2024-12-02 07:17:22 字数 9766 浏览 1 评论 0原文

喂!

我正在尝试使用 CXF 创建 Web 服务客户端。我的应用程序在 OSGi 中。我使用 Felix 框架。

但出现以下错误:

[main] ERROR org.apache.cxf.BusFactory - Failed to determine BusFactory implementation class name.
java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.cxf.BusFactory.getBusFactoryClass(BusFactory.java:280)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:207)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Service.java:36)
    at myorg.engine.test.mocks.soapservice.client.CHMService.<init>(CHMService.java:42)
    at myorg.engine.service.OSGiServiceTest.testSoapServiceMock(OSGiServiceTest.java:133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:112)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(ProbeInvokerImpl.java:71)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvokerImpl.java:58)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:83)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:85)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:259)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

[main] ERROR org.apache.cxf.BusFactory - Failed to instantiate bus factory.
java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:218)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Service.java:36)
    at myorg.engine.test.mocks.soapservice.client.CHMService.<init>(CHMService.java:42)
    at myorg.engine.service.OSGiServiceTest.testSoapServiceMock(OSGiServiceTest.java:133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:112)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(ProbeInvokerImpl.java:71)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvokerImpl.java:58)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:83)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:85)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:259)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
[org.ops4j.pax.exam.junit.JUnit4TestRunner] : Exception
org.ops4j.pax.exam.TestContainerException: java.lang.reflect.InvocationTargetException
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:118)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(ProbeInvokerImpl.java:71)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvokerImpl.java:58)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:83)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:85)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:259)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:112)
    ... 20 more

Caused by: java.lang.RuntimeException: java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:224)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Service.java:36)
    at myorg.engine.test.mocks.soapservice.client.CHMService.<init>(CHMService.java:42)
    at myorg.engine.service.OSGiServiceTest.testSoapServiceMock(OSGiServiceTest.java:133)
    ... 25 more

Caused by: java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:218)
    ... 33 more

我说可能是因为不同的ClassLoader。是否可以?

知道如何解决这个问题吗?

谢谢!

Helo!

I'm trying to create a Web Service client using CXF. My application is in OSGi. And I use the Felix Framework.

But the following error occurs:

[main] ERROR org.apache.cxf.BusFactory - Failed to determine BusFactory implementation class name.
java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.cxf.BusFactory.getBusFactoryClass(BusFactory.java:280)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:207)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Service.java:36)
    at myorg.engine.test.mocks.soapservice.client.CHMService.<init>(CHMService.java:42)
    at myorg.engine.service.OSGiServiceTest.testSoapServiceMock(OSGiServiceTest.java:133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:112)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(ProbeInvokerImpl.java:71)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvokerImpl.java:58)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:83)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:85)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:259)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

[main] ERROR org.apache.cxf.BusFactory - Failed to instantiate bus factory.
java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:218)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Service.java:36)
    at myorg.engine.test.mocks.soapservice.client.CHMService.<init>(CHMService.java:42)
    at myorg.engine.service.OSGiServiceTest.testSoapServiceMock(OSGiServiceTest.java:133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:112)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(ProbeInvokerImpl.java:71)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvokerImpl.java:58)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:83)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:85)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:259)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
[org.ops4j.pax.exam.junit.JUnit4TestRunner] : Exception
org.ops4j.pax.exam.TestContainerException: java.lang.reflect.InvocationTargetException
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:118)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.findAndInvoke(ProbeInvokerImpl.java:71)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.call(ProbeInvokerImpl.java:58)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.call(NativeTestContainer.java:83)
    at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:85)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:259)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:86)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.ops4j.pax.exam.raw.extender.intern.ProbeInvokerImpl.injectContextAndInvoke(ProbeInvokerImpl.java:112)
    ... 20 more

Caused by: java.lang.RuntimeException: java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:224)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:194)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:90)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:137)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:122)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Service.java:36)
    at myorg.engine.test.mocks.soapservice.client.CHMService.<init>(CHMService.java:42)
    at myorg.engine.service.OSGiServiceTest.testSoapServiceMock(OSGiServiceTest.java:133)
    ... 25 more

Caused by: java.lang.ClassCastException: class org.apache.cxf.bus.spring.SpringBusFactory
    at java.lang.Class.asSubclass(Unknown Source)
    at org.apache.cxf.BusFactory.newInstance(BusFactory.java:218)
    ... 33 more

I said it could be because of different ClassLoader. Is it possible?

Any idea how to solve the problem?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小伙你站住 2024-12-09 07:17:22

是的,看起来您有两个 BusFactory 类定义。 SpringBusFactory 实现其中一个,而 asSubclass() 调用则对另一个进行。由于一个 BusFactory 与另一个 BusFactory 不是同一类,因此您将获得 CCE。查找包含 BusFactory 类的两个不同的包。其中之一将由定义 SpringBusFactory 的包导入。

Yes, it looks like you have two BusFactory class definitions. The SpringBusFactory implements one of them, and the asSubclass() call is made on the other. Since one BusFactory isn't the same class as the other, you'd get a CCE. Look for two different bundles containing the BusFactory class. One of them will be imported by the bundle that defines the SpringBusFactory.

山川志 2024-12-09 07:17:22

我认为“两个 BusFactory 类定义”是一个转移注意力的话题。

不确定您使用的是哪个版本的 CXF(猜测是 2.4.2),但该代码在查找子类实现时尝试使用线程上下文类加载器执行 ServiceLoader 类型的操作。

我最好的猜测是 CXF 依赖于一些 Spring“魔法”,而您缺少提供它的捆绑包。查看 Karaf 的 CXF 功能,它有大量依赖项,请检查这一点并确保您已获得所有依赖项 - 此时,使用安装了 CXF 功能的 karaf 进行尝试可能会更容易。

如果您使用 Maven,则可以通过以下方式访问功能文件:

    <dependency>
        <groupId>org.apache.cxf.karaf</groupId>
        <artifactId>apache-cxf</artifactId>
        <version>2.4.2</version>
        <type>xml</type>
        <classifier>features</classifier>
    </dependency>

有关总线配置的一些文档 此处

I think the "two BusFactory class definitions" is a red herring.

Not sure what version of CXF you're using (guessing 2.4.2) but that code is trying to do ServiceLoader kind of stuff using the thread context classloader when looking for subclass implementations.

My best guess is there some Spring "magic" that CXF relies on and your missing the bundle that provides it. Looking at the CXF feature for Karaf it has loads of dependencies, check this and ensure you've got them all - at this point it may be easier to try this out using karaf with the CXF feature installed.

If you're using maven the features file can be accessed with this:

    <dependency>
        <groupId>org.apache.cxf.karaf</groupId>
        <artifactId>apache-cxf</artifactId>
        <version>2.4.2</version>
        <type>xml</type>
        <classifier>features</classifier>
    </dependency>

Some documentation on bus configuration here

归属感 2024-12-09 07:17:22

我过去曾在 pax-exam 中看到过类似的奇怪错误。这是否在“正常”OSGi 环境中的 pax-exam 之外运行? Talend Service Factory ( http://talend.com/products/tsf ) 有几个示例(在单独的在 OSGi 中运行的 CXF 客户端和服务的示例下载包),它们都可以工作。

I've seen strange errors like that with pax-exam in the past. Does this run outside of pax-exam in a "normal" OSGi environment? Talend Service Factory ( http://talend.com/products/tsf ) has several examples (in the separate examples download package) of CXF clients and services running in OSGi and they all do work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文