2016-12-02 201 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"/>