gpt4 book ai didi

Tomcat 6 web服务未部署404错误

转载 作者:行者123 更新时间:2023-11-28 22:31:39 25 4
gpt4 key购买 nike

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

我使用了这个例子中的代码

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

但无法使用 war ,因为我在 server.xml 中设置了上下文信息

所以我使用与 mkyong 相同的代码,但是按照

上的步骤部署它

How to manually deploy a web service on Tomcat 6?

我一直在努力,直到 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:49 com.sun.xml.ws.transport.http.servlet.WSServletDelegate信息:WSSERVLET14:JAX-WS servlet 正在初始化2013 年 2 月 26 日下午 12:17:49 org.apache.catalina.startup.HostConfig deployDescriptor信息:部署配置描述符 trafficschoolgirls.com.xml2013 年 2 月 26 日下午 12:17:49 com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized信息:WSSERVLET12:JAX-WS 上下文监听器正在初始化2013 年 2 月 26 日下午 12:17:51 com.sun.xml.ws.transport.http.servlet.WSServletDelegate信息:WSSERVLET14:JAX-WS servlet 正在初始化

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

谢谢你的时间,

多莉

最佳答案

我在同一个应用程序的 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

希望对您有所帮助。

关于Tomcat 6 web服务未部署404错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15099595/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com