【发布时间】:2014-06-19 17:18:15
【问题描述】:
我正在使用tomcat 7.0 服务器在Eclipse 中开发一个动态Web 应用程序和http-servlet。服务器没有突然启动,仍然返回如下异常:
java.lang.IllegalArgumentException: The servlets named [core.Flowpost_h1_h3] and [core.Flowpost_h2_h1] are both mapped to the url-pattern [/Flowpost] which is not permitted
我可以看到我的 http servlet 类“Flowpost_h1_h3”和“Flowpost_h2_h1”都有:
@WebServlet("/Flowpost")
public class Flowpost_h2_h1 extends HttpServlet {
和
@WebServlet("/Flowpost")
public class Flowpost_h1_h3 extends HttpServlet {
即使我在其中一个类中更改“/Flowpost”,它仍然返回完全相同的错误。我需要在我的项目中修改什么来摆脱这个问题?
我的 web.xml:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>printinfo_rest</display-name>
<servlet>
<servlet-name>PrintInfo</servlet-name>
<servlet-class>core.PrintInfo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PrintInfo</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
提前致谢
【问题讨论】:
标签: java eclipse apache tomcat servlets