我正在尝试使用maven在Tomcat7中部署web服务。
下面我提供一些配置信息:
web.xml
...
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
...pom.xml
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/services/userinfo</path>
...给定<url-pattern>/services/*</url-pattern>和<path>/services/userinfo</path>配置,URL http://localhost:8080/services/userinfo显示404。
如果使用<url-pattern>/*</url-pattern>,则一切都按预期工作(即,http://localhost:8080/services/userinfo显示可用方法的列表)。
问题:
为什么/services/*在我的情况下不起作用?
发布于 2013-08-11 16:19:59
在tomcat-maven-plugin配置中的路径
<path>/services/userinfo</path>定义部署webapp的位置(上下文根)。在本例中,您将它部署到
http://localhost:8080/services/userinfo查看Tomcat安装中的webapp目录。
由于您将CXFServlet映射定义为/services/*,CXF服务列表将显示在
http://localhost:8080/services/userinfo/services/当您重新定义到/*的映射时,它看起来就像预期的那样工作,但这只是因为您使用的上下文根和您期望的服务列表路径是相同的。
https://stackoverflow.com/questions/18166594
复制相似问题