问题:
七月 26, 2016 8:29:52 下午 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.webservice.et.cn/}WebServiceImplService from class cn.et.webservice.service.WebServiceInterf Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStreamat org.apache.cxf.transport.http_jetty.JettyDestinationFactory.createDestination(JettyDestinationFactory.java:37)at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:281)at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:135)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)at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:442)at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:329)at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:246)at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:146)at javax.xml.ws.Endpoint.publish(Endpoint.java:240)at cn.et.webservice.service.TestWebService.main(TestWebService.java:23)Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletOutputStreamat java.net.URLClassLoader$1.run(URLClassLoader.java:366)at java.net.URLClassLoader$1.run(URLClassLoader.java:355)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:354)at java.lang.ClassLoader.loadClass(ClassLoader.java:423)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)at java.lang.ClassLoader.loadClass(ClassLoader.java:356)... 13 more
解决方法:
这是因为缺少jar包,在lib下面导入servlet-api.jar就可以了,servlet-api.jar在tomcat的lib里面就可以找到