【发布时间】:2012-08-08 10:41:32
【问题描述】:
我的项目名为“A”,我的班级是:
@WebServlet(urlPatterns={"/test/*"})
public class RequestHandler extends HttpServlet {
Maven 插件:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
</plugin>
在 src/main/webapp/WEB-INF/web.xml 我有
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_3_0.xsd" version="3.0"/>
Tomcat7在运行tomcat7时是这样启动的:运行:
Running war on http://localhost:8080/A
...
2012 年 8 月 8 日下午 12:28:08 org.apache.coyote.AbstractProtocol 初始化 信息:初始化 ProtocolHandler ["http-bio-8080"] 2012 年 8 月 8 日 12:28:08 PM org.apache.catalina.core.StandardService startInternal 信息:启动服务Tomcat 2012 年 8 月 8 日下午 12:28:08 org.apache.catalina.core.StandardEngine startInternal 信息:启动 Servlet 引擎:Apache Tomcat/7.0.25 2012 年 8 月 8 日下午 12:28:08 org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment 信息:未找到全局 web.xml 2012 年 8 月 8 日 12:28:09 PM org.apache.coyote.AbstractProtocol 开始 信息:启动 ProtocolHandler ["http-bio-8080"]
当我转到 http://localhost:8080/A 或 http://localhost:8080/A/test 时,我从 Tomcat7 得到一个 404
我做错了什么?
【问题讨论】:
标签: tomcat maven servlets tomcat7