2013-02-26 94 views
1

我一直在尝试在tomcat上部署简单的Web服务,但我没有成功,它总是返回我404错误。Tomcat 6 Web服务未部署404错误

我使用的代码从这个例子

http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/

但不能使用战争,因为我有上下文信息建立在server.xml中

于是我就用相同的符号, mkyong,但与步骤上

How to manually deploy a web service on Tomcat 6?

我在它的工作部署它,直到有是正o在catalina.log更多的错误,我仍然得到404错误

当我看看日志,有这样

2013年2月26日下午12时17分48秒了com.sun.xml一些消息.ws.transport.http.servlet.WSServletContextListener contextInitialized 信息:WSSERVLET12:JAX-WS上下文侦听器初始化 2013年2月26日下午12时17分四十九秒com.sun.xml.ws.transport.http.servlet.WSServletDelegate 信息:WSSERVLET14:JAX-WS servlet初始化 Feb 26,2013 12:17:49 PM org.apache.catalina.startup.HostConfig deployDescriptor 信息:部署配置描述符trafficschoolgirls.com.xml Feb 26,20 13 12:17:49 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized INFO:WSSERVLET12:JAX-WS上下文侦听器初始化 2013年2月26日下午12时17分51秒55分com.sun.xml .ws.transport.http.servlet.WSServletDelegate 信息:WSSERVLET14:JAX-WS servlet初始化

所以我的ws设置正确吗?但我真的不知道为什么它仍然无法工作,是否有任何其他日志可以检查或我需要设置的位置才能让ws运行?我需要做什么端口设置?

谢谢您的时间,

多莉

回答

0

我在Tomcat的6两个Web服务在同一应用程序。

有文件/WEB-INF/sun-jaxws.xml个别url-pattern

<?xml version="1.0" encoding="UTF-8"?> 
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0"> 
    <endpoint name="HtmlPageService" 
       implementation="org.paulvargas.tools.soap.HtmlPageService" 
       url-pattern="/HtmlPageService" /> 
    <endpoint name="BinaryFileService" 
       implementation="org.paulvargas.tools.soap.BinaryFileService" 
       url-pattern="/BinaryFileService" /> 
</endpoints> 

在两个端点这url-pattern也是WSServletservlet-mapping

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> 
<display-name>soap</display-name> 
<listener> 
    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class> 
</listener> 
<servlet> 
    <servlet-name>Service</servlet-name> 
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> 
    <load-on-startup>0</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>Service</servlet-name> 
    <url-pattern>/HtmlPageService</url-pattern> 
    <url-pattern>/BinaryFileService</url-pattern> 
</servlet-mapping> 
<welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
</welcome-file-list> 
</web-app> 

的应用程序已经在未来图书馆:

commons-io-2.4.jar 
gmbal-api-only.jar 
ha-api.jar 
jaxb-impl.jar 
jaxws-api.jar 
jaxws-rt.jar 
management-api.jar 
mimepull-1.3.jar 
policy.jar 
stax-ex.jar 
streambuffer.jar 

上启动Tomcat的输出是

Feb 26, 2013 7:16:58 PM org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-8080 
Feb 26, 2013 7:16:58 PM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 438 ms 
Feb 26, 2013 7:16:58 PM org.apache.catalina.core.StandardService start 
INFO: Starting service Catalina 
Feb 26, 2013 7:16:58 PM org.apache.catalina.core.StandardEngine start 
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35 
Feb 26, 2013 7:16:58 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized 
INFO: WSSERVLET12: JAX-WS context listener initializing 
Feb 26, 2013 7:16:59 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate <init> 
INFO: WSSERVLET14: JAX-WS servlet initializing 
Feb 26, 2013 7:16:59 PM org.apache.coyote.http11.Http11Protocol start 
INFO: Starting Coyote HTTP/1.1 on http-8080 
Feb 26, 2013 7:16:59 PM org.apache.jk.common.ChannelSocket init 
INFO: JK: ajp13 listening on /0.0.0.0:8009 
Feb 26, 2013 7:16:59 PM org.apache.jk.server.JkMain start 
INFO: Jk running ID=0 time=0/17 config=null 
Feb 26, 2013 7:16:59 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 1608 ms 

的去URL http://localhost:8080/soap/HtmlPageService

 Service Name: {http://soap.tools.paulvargas.org/}HtmlPageServiceService 
      Port Name: {http://soap.tools.paulvargas.org/}HtmlPageServicePort 
      Address: http://localhost:8080/soap/HtmlPageService 
       WSDL: http://localhost:8080/soap/HtmlPageService?wsdl 
Implementation class: org.paulvargas.tools.soap.HtmlPageService 

     Service Name: {http://soap.tools.paulvargas.org/}BinaryFileServiceService 
      Port Name: {http://soap.tools.paulvargas.org/}BinaryFileServicePort 
      Address: http://localhost:8080/soap/BinaryFileService 
       WSDL: http://localhost:8080/soap/BinaryFileService?wsdl 
Implementation class: org.paulvargas.tools.soap.BinaryFileService 

我希望这可以帮助你。

+0

非常感谢您的回复。我得到了和你一样的tomcat输出,但是我仍然没有运气。其实我想把它放在像http://www.xyz.com/soap/HtmlPageService这样的实时服务器上,你认为这可能是它不工作的原因吗? – 2013-03-01 21:28:26

+0

我发现只是我的网址。对于我的,它会变成xyz.com/HtmlPageService而不是 – 2013-03-02 00:13:41

+0

如果您打算将它作为项目ROOT放在Tomcat中,那就是对的。就我而言,应用程序上下文是“soap”。 – 2013-03-02 00:17:25