使用Maven3 Eclipse 7 Tomcat 7时出现404错误的WebServlet
我的项目名为“A”,我的班级是:使用Maven3 Eclipse 7 Tomcat 7时出现404错误的WebServlet,tomcat,maven,servlets,tomcat7,Tomcat,Maven,Servlets,Tomcat7,我的项目名为“A”,我的班级是: @WebServlet(urlPatterns={”/test/*“}) 公共类RequestHandler扩展了HttpServlet{ Maven插件: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> </plu
@WebServlet(urlPatterns={”/test/*“})
公共类RequestHandler扩展了HttpServlet{
Maven插件:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
</plugin>
2012年8月8日12:28:08 PM org.apache.coyote.AbstractProtocol init
信息:正在初始化ProtocolHandler[“http-bio-8080”]
2012年8月8日12:28:08 PM org.apache.catalina.core.StandardService startInternal
信息:启动服务Tomcat
2012年8月8日12:28:08 PM org.apache.catalina.core.StandardEngine startInternal
信息:启动Servlet引擎:ApacheTomcat/7.0.25
2012年8月8日12:28:08 PM 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
我做错了什么?删除web.xml文件 使用以下配置pom.xml:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8080</port>
<path>/</path>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.29</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
</pluginRepository>
</pluginRepositories>
org.apache.tomcat.maven
tomcat7 maven插件
2.0-快照
org.apache.maven.plugins
maven编译器插件
2.5.1
org.apache.tomcat.maven
tomcat7 maven插件
8080
/
org.apache.tomcat.embed
tomcat嵌入式内核
7.0.29
org.apache.maven.plugins
maven编译器插件
1.7
1.7
真的
真的
真的
apache.snapshots
Apache快照
http://repository.apache.org/content/groups/snapshots-group/
Running war on http://localhost:8080/A
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8080</port>
<path>/</path>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.29</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
</pluginRepository>
</pluginRepositories>