鍍金池/ 問(wèn)答/Java  Linux/ tomcat 啟動(dòng)的問(wèn)題。

tomcat 啟動(dòng)的問(wèn)題。

maven項(xiàng)目下用的tomcat插件,啟動(dòng)后,訪問(wèn)地址為 Running war on http://localhost:8080/Musical,而不是正常的http://localhost:8080/ 這是為啥呢?是不是因?yàn)槿鄙倥渲媚??下面截圖為pom.xml

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"]
回答
編輯回答
撥弦

圖片描述

2017年8月8日 23:48
編輯回答
遺莣

上面的 answer 表達(dá)得很清楚了;
通過(guò)日志,查看相關(guān)輸出是哪個(gè) maven 插件去執(zhí)行的,比如 tomcat7-maven-plugin,然后去看看該插件的 Usage,基本可以解決問(wèn)題。

2017年5月26日 11:58
編輯回答
逗婦乳

全局搜索 Musical ,看在哪里配置了Musical 這個(gè)路徑

2017年8月2日 19:06
編輯回答
乞許

解決辦法,在配置插件的時(shí)候加入了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>
2017年7月14日 13:21