tomcat 启动的问题。
maven项目下用的tomcat插件,启动后,访问地址为 Running war on http://localhost/:8080/Musical,而不是正常的http://localhost/:8080/ 这是为啥呢?是不是因为缺少配置呢?下面截图为pom.xml
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Musical Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.0:run (default-cli) > compile @ Musical >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Musical ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Musical ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /home/swj/IdeaProjects/Musical/target/classes
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.0:run (default-cli) < compile @ Musical <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.0:run (default-cli) @ Musical ---
[INFO] Running war on http://localhost/:8080/Musical
[INFO] Creating Tomcat server configuration at /home/swj/IdeaProjects/Musical/target/tomcat
[INFO] create webapp with contextPath: /Musical
Dec 11, 2017 6:48:16 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 11, 2017 6:48:16 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Dec 11, 2017 6:48:16 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
Dec 11, 2017 6:48:18 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
[INFO] Root WebApplicationContext: initialization started
Dec 11, 2017 6:48:18 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
[INFO] Refreshing Root WebApplicationContext: startup date [Mon Dec 11 18:48:18 CST 2017]; root of context hierarchy
[INFO] Loading XML bean definitions from class path resource [application-context.xml]
[INFO] Initializing ExecutorService 'taskExecutor'
[INFO] Root WebApplicationContext: initialization completed in 748 ms
Dec 11, 2017 6:48:19 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
回答:
回答:
全局搜索 Musical ,看在哪里配置了Musical 这个路径
回答:
解决办法,在配置插件的时候加入了configure属性
<plugin> <groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<path>/</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
<server>tomcat7</server>
</configuration>
</plugin>
回答:
上面的 answer 表达得很清楚了;
通过日志,查看相关输出是哪个 maven 插件去执行的,比如 tomcat7-maven-plugin,然后去看看该插件的 Usage,基本可以解决问题。
以上是 tomcat 启动的问题。 的全部内容, 来源链接: utcz.com/p/176839.html