2016-12-02 236 views
1

我想將基於Maven的war文件部署到Tomcat。 用到的技術:Maven部署到Tomcat

的Maven 3.1.1 的Eclipse 4.2 JDK 7 春4.1.1.RELEASED 的Tomcat 7 的logback 1.0.13

我有這個插件在我的maven文件:

<!-- For Maven Tomcat Plugin --> 
      <plugin> 
      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat7-maven-plugin</artifactId> 
      <version>2.2</version> 
      <configuration> 
       <url>http://localhost:8080/manager/text</url> 
       <server>TomcatServer</server> 
       <path>/DevicesCloudWebApp</path> 
       <username>admin</username> 
       <password>admin</password> 
       <update>true</update> 
      </configuration> 
      </plugin> 
我有這樣的錯誤:像
[DEBUG] Connection 0.0.0.0:62265<->127.0.0.1:8080 closed 
    [INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ DevicesCloudWebApp >>> 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DevicesCloudWebApp --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 1 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ DevicesCloudWebApp --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ DevicesCloudWebApp --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/src/test/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ DevicesCloudWebApp --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ DevicesCloudWebApp --- 
[INFO] No tests to run. 
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ DevicesCloudWebApp --- 
[INFO] Packaging webapp 
[INFO] Assembling webapp [DevicesCloudWebApp] in [/Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/target/DevicesCloudWebApp] 
[INFO] Processing war project 
[INFO] Copying webapp resources [/Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/src/main/webapp] 
[INFO] Webapp assembled in [97 msecs] 
[INFO] Building war: /Users/nullpointer/Development/J2EE/eclipseWSJ2EE/DevicesCloudWebApp/target/DevicesCloudWebApp.war 
[INFO] WEB-INF/web.xml already added, skipping 
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ DevicesCloudWebApp <<< 
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ DevicesCloudWebApp --- 
[INFO] Deploying war to http://localhost:8080/DeviceslCloudWebApp 
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp 
2170/6062 KB 
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe 
[INFO] Retrying request 
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp 
2198/6062 KB 
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe 
[INFO] Retrying request 
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp 
2176/6062 KB 
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe 
[INFO] Retrying request 
Uploading: http://localhost:8080/manager/text/deploy?path=%2FDeviceslCloudWebApp 
2188/6062 KB 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.922 s 
[INFO] Finished at: 2016-12-02T20:57:29+01:00 
[INFO] Final Memory: 16M/303M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project DevicesCloudWebApp: Cannot invoke Tomcat manager: Broken pipe -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
+0

我們需要看到進一步回到這個錯誤登錄。導致它無法正常啓動的錯誤在那裏。 –

回答

5

嘗試增加驗證配置下

<plugin> 
     <groupId>org.apache.tomcat.maven</groupId> 
     <artifactId>tomcat7-maven-plugin</artifactId> 
     <version>${tomcat7-maven-plugin.version}</version> 
     <configuration> 
      <url>http://localhost:8080/manager/text</url> 
      <server>tomcat</server> 
      <username>admin1</username> 
      <password>admin1</password> 
      <path>/${project.artifactId}</path> 
      <update>true</update> 
     </configuration> 
</plugin> 

更新像下面的角色配置在tomcat - >$CATALINA_HOME/conf/tomcat-users.xml<tomcat-users>元素

<role rolename="manager-script"/> 
<role rolename="manager-gui"/> 
<user username="admin" password="admin" roles="manager-gui"/> 
<user username="admin1" password="admin1" roles="manager-script"/>