在控制台模式下使用Apache CXF JaxWsServerFactoryBean时(尝试通过java命令行启动服务器)将获得如下异常:
Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:295)
at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:143)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:160)
Run Code Online (Sandbox Code Playgroud)
当通过Spring在Tomcat中使用相同的服务impl时,它可以工作.
<jaxws:endpoint id="abc" implementor="com.AbcServicePortTypeImpl" address="/abc">
Run Code Online (Sandbox Code Playgroud)
sen*_*982 79
在maven pom.xml中包含cxf-rt-transports-http-jetty jar将解决问题.
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>2.7.6</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
另一个适用于 CSV 2.7.15 的解决方案:当您创建 时Bus,注册一个扩展:
ServletDestinationFactory destinationFactory = new ServletDestinationFactory();
bus.setExtension(destinationFactory, HttpDestinationFactory.class);
Run Code Online (Sandbox Code Playgroud)
小智 5
例如,如果您具有以下配置并且地址定义为附加了http,这不是配置的CXFServlet的相对URL,则会出现上述错误.
<jaxrs:server id="helloRestService" address="http://...">
<jaxrs:serviceBeans>
<ref bean="helloService" />
</jaxrs:serviceBeans>
</jaxrs:server>
Run Code Online (Sandbox Code Playgroud)
解决方案是简单地提及没有http/https附加到地址的相对URL.
我有同样的问题。谷歌的所有内容都毫无意义。我发现在我的情况下,我在 spring 上下文文件中缺少以下内容:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29435 次 |
| 最近记录: |