异常信息:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.cxf.transport.servlet.ServletDestination: method <init>(Lorg/apache/cxf/Bus;Lorg/apache/cxf/transport/http/DestinationRegistry;Lorg/apache/cxf/service/model/EndpointInfo;Ljava/lang/String;Z)V not found
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:93)
at org.apache.cxf.transport.http_jetty.JettyDestinationFactory.createDestination(JettyDestinationFactory.java:37)
at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:278)
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)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:152)
at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
at com.hg.ws.server.MyServer_ws.main(MyServer_ws.java:17)
原因:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.1.1</version>
</dependency>
程序中使用了3.1.1版本的jetty包,
解决办法:
我自己是使用3.0.1版本的包后,解决了问题,猜测jetty版本和jaxws版本需要一致?或者3.1.1的版本删除了某些内容所致?