异常信息:
严重: Cannot find any registered HttpDestinationFactory from the Bus.
Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:188)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at demo.ws.soap_cxf.JaxWsServer.main(JaxWsServer.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:269)
at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:131)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:84)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:63)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:170)
... 7 more
Process finished with exit code 1
在使用cxf过程中经常出 Cannot find any registered HttpDestinationFactory from the Bus,一般是没有引入cxf-rt-transports-http-jetty-xxx.jar。查看apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:270)类,jettyFactory为null,也就是缺少http-jetty的实现。
解决办法:
在pom.xml文件中添加: