我正在尝试通过 tomcat maven 插件将 war 部署到嵌入式 tomcat 服务器。控制台显示服务器启动正常。
看来 war 还没有展开。当我访问 http://localhost:9090/foo 时,我从 Tomcat 收到 HTTP 状态 404和 http://localhost:9090
我在 target/tomcat/webapps 中没有看到 war 文件或分解的 war 文件
由于我无法控制的因素,我的配置有点(非常)不标准:
- 该项目使用 Maven 以外的其他方式构建 war 文件。
- 该项目不是根据 Maven 标准设置的。
- 该项目的包类型为 POM。
POM:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.foo
foo
0.0.1-SNAPSHOT
pom
iCON
org.apache.tomcat.maven
tomcat7-maven-plugin
2.2
true
foo.war
9090
mvn tomcat7:run 的输出
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building foo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ foo >>>
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:run (default-cli) < process-classes @ foo <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run (default-cli) @ foo ---
[INFO] Running war on http://localhost:9090/foo
[INFO] Creating Tomcat server configuration at C:\someDir\aProject\target\tomcat
[INFO] create webapp with contextPath: /foo
Apr 15, 2015 12:50:56 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9090"]
Apr 15, 2015 12:50:56 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Apr 15, 2015 12:50:56 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Apr 15, 2015 12:50:58 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9090"]
Tôi là một lập trình viên xuất sắc, rất giỏi!