安装完MyEclipse 2014,用JAX-WS的方式写了一个小段Web Service,用MyEclipse 自带的 Tomcat 部署没有问题,用我自己的,却出现下面的错误:
java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:530)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:512)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4907)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
根据提示,找不到com.sun.xml.ws.transport.http.servlet.WSServletContextListener,一看这就是缺少包,于是在MyeElips中添加了相应的包,右键工程-Build Path-Add Library:
可是问题依然,于是将MyEclispe 自带的Tomcat给停止了:
问题还是依旧,本想将WS需要的包找到直接放到部署目录的lib下,一时间又找不到那几个,于是将不是的WS 删掉了,重新部署,奇迹就这么出现了,于是到部署目录中看了下,WS需要的包有哪些:
Tomcat终于没有错误了,于是在浏览器中进行访问:http://localhost:8080/MyWS/DemoPort,可以看到WSDL了。