使用maven插件Tomcat7 启动成功但是404的问题
2017-09-08 21:41
1696 查看
使用maven插件Tomcat7
tomcat7-maven-plugin 插件配置
启动Tomcat7
使用Maven build
使用Maven 命令
其它命令
启动成功
启动失败问题
启动成功但是404
此时访问
仔细检查你的默认html或者jsp等等是否与web.xml中配置的一致
tomcat7-maven-plugin 插件配置
启动Tomcat7
使用Maven build
使用Maven 命令
其它命令
启动成功
启动失败问题
启动成功但是404
使用maven插件Tomcat7
tomcat7-maven-plugin 插件配置
在pom.xml文件加入<build> <!-- 配置插件 --> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <update>true</update> <!-- 热部署 --> <charset>utf-8</charset> <!-- 设置字符集 --> <uriEncoding>UTF-8</uriEncoding><!-- 设置uri编码 --> <port>8888</port> <!-- 设置端口 --> <path>/</path><!-- 设置默认访问应用的路径 --> <url>http://127.0.0.1:8888/manager/text</url> </configuration> </plugin> </plugins> </build>
启动Tomcat7
使用Maven build
使用Maven 命令
在命令行中输入mvn clean tomcat7:run
其它命令
tomcat7:run -- 启动嵌入式tomcat ,并运行当前项目 tomcat7:deploy --部署一个web war包 tomcat7:reload --重新加载web war包 tomcat7:start --启动tomcat tomcat7:stop --停止tomcat tomcat7:undeploy--停止一个war包
启动成功
控制台输出:[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ taotao-manager-web --- [INFO] Running war on http://localhost:8888/ [INFO] Creating Tomcat server configuration at D:\JetBrains\IdeaProjects\taotao\taotao-manager\taotao-manager-web\target\tomcat [INFO] create webapp with contextPath: 九月 08, 2017 8:38:08 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8888"] 九月 08, 2017 8:38:08 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Tomcat 九月 08, 2017 8:38:08 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.47 九月 08, 2017 8:38:12 下午 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplicationInitializer types detected on classpath 九月 08, 2017 8:38:12 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-8888"]
此时访问
http://localhost:8888/即可
启动失败问题
需要修改依赖<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>${servlet-api.version}</version><!-- 版本自己定义 --> <scope>provided</scope><!-- 必须要有 --> </dependency>
启动成功但是404
遇到404 肯定是因为路径错误仔细检查你的默认html或者jsp等等是否与web.xml中配置的一致
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome- a296 file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
相关文章推荐
- IDEA使用maven中tomcat插件启动项目乱码问题
- 使用maven的tomcat插件启动时报错问题
- 使用maven的tomcat插件启动时报错问题
- 005商城项目:ssm框架的整合成功之后的问题:使用maven的tomcat插件时的debug
- Maven项目使用tomcat插件启动后报内存溢出
- 使用Maven的antrun插件启动Tomcat的两种方法
- 淘淘商城系列——使用maven tomcat插件启动web工程
- maven使用tomcat插件自动化部署——编码问题
- 解决eclipse中启动Tomcat成功但是访问不了Tomcat问题
- maven使用tomcat插件启动web项目时控制台没有反应
- 商城项目实战03:使用maven tomcat插件启动聚合工程
- tomcat 使用心得(问题)-eclipse 启动tomcat 后 浏览器访问404 --eclipse复制工程显示原来的工程名
- tomcat启动成功但是访问时报404
- tomcat启动成功但是访问方面都是404
- IDEA使用Tomcat和Maven插件启动maven项目的参数配置;
- 在java maven工程中,使用tomcat插件启动web应用
- 启动tomcat显示成功,但是访问tomcat首页是404错误页
- (转)淘淘商城系列——使用maven tomcat插件启动web工程
- eclipse 中使用tomcat插件部署后访问应用404问题解决
- 淘淘商城系列——使用maven tomcat插件启动web工程