gpt4 book ai didi

java - Tomcat8 org.apache.cxf.BusFactory.getBusFactoryClass 无法确定 BusFactory 实现类名

转载 作者:行者123 更新时间:2023-11-28 23:22:03 24 4
gpt4 key购买 nike

我已经通过 Arquillian (1.1.12.Final) 将一个应用程序部署到 Tomcat 8.5.11,其中查询了一个 webervice。该应用程序将 Apache CXF 3.1.10 作为提供的依赖项;所有 cxf 和 spring JAR 都添加到 Tomcat 上的 endorsed 库目录中(我已验证所有认可的 JAR 都已正确加载)。

尽管如此,我还是遇到了上述错误消息。堆栈跟踪的相关位是

java.lang.NullPointerException
at org.apache.cxf.BusFactory.getBusFactoryClass(BusFactory.java:397)
at org.apache.cxf.BusFactory.newInstance(BusFactory.java:317)
at org.apache.cxf.BusFactory.newInstance(BusFactory.java:304)
at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:107)
at org.apache.cxf.BusFactory.createThreadBus(BusFactory.java:244)
at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:228)
at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:135)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
at javax.xml.ws.Service.<init>(Service.java:77)

[剪断]

java.lang.NullPointerException
at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:166)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:160)
at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:107)
at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:178)
at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:185)
at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:40)
at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:36)
at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:32)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:146)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:122)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:94)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:83)
at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:107)
at org.apache.cxf.BusFactory.createThreadBus(BusFactory.java:244)
at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:228)
at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:135)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
at javax.xml.ws.Service.<init>(Service.java:77)

NPE 发生在网络服务初始化期间。失败的代码是

// org.apache.cxf.bus.extension.ExtensionManagerImpl
final void load(String resource) throws IOException {
if (loader != getClass().getClassLoader()) {
load(resource, getClass().getClassLoader());
}
load(resource, loader);
}

事实证明,调用 getClass().getClassLooader() 返回 null。我对这个结果感到困惑才发现getClass().getClassLoader() is null, why?这对我来说仍然没有意义,因为我认为这意味着 CXF 是使用引导类路径加载的(!?!)。

最佳答案

问题是由于将 CXF jar 放在 $CATALINA_HOME/endoresed 中引起的。这是放置所有 web 应用程序通用的 jar 的错误位置。如 http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html 所述在“XML 解析器和 Java”部分。

关于java - Tomcat8 org.apache.cxf.BusFactory.getBusFactoryClass 无法确定 BusFactory 实现类名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42341942/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com