我是Apache CXF和tomcat的新手。我正在尝试构建一个简单的Web服务并将其部署到Tomcat上。下面是我的web.xml 但是,当我尝试使用我的浏览器访问'services'文件夹时,它说没有找到服务。我尝试创建Java Web服务客户端,但它无法找到服务。这可能是什么错误?Apache CXF和tomcat
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Sample web service provider</display-name>
<listener>
<!-- For Metro, use this listener-class instead:
com.sun.xml.ws.transport.http.servlet.WSServletContextListener -->
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Remove below context-param element if using Metro -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:META-INF/cxf/cxf.xml
</param-value>
</context-param>
<servlet>
<servlet-name>WebServicePort</servlet-name>
<!-- For Metro, use this servlet-class instead:
com.sun.xml.ws.transport.http.servlet.WSServlet -->
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WebServicePort</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
虽然此链接可以回答这个问题,最好是在这里有答案的主要部件,并提供链接以供参考创建CXF服务教程。如果链接页面更改,则仅链接答案可能会失效。 – tbodt 2015-01-22 19:25:12
好的,我已经更新了缺少的信息的答案。希望能帮助到你。 – 2015-01-22 19:33:13