mvn tomcat7:部署目标失败无法调用Tomcat管理器:连接被拒绝

时间:2016-09-16 05:30:35

标签: java maven tomcat maven-tomcat-plugin

我正在尝试在GitHub上学习开源项目。 github project link它的多模块项目,为此,我可以成功执行mvn clean install。但问题是当我使用mvn tomcat7:deploy进行部署时,它会在下面给出错误。那我该如何设置这个本地项目类型,请帮助如何在tomcat上成功部署它 错误低于--->

    mvn tomcat7:deploy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] com.zuoxiaolong.blog:everyone-java-blog
[INFO] com.zuoxiaolong.blog:blog-common
[INFO] com.zuoxiaolong.blog:blog-model
[INFO] com.zuoxiaolong.blog:blog-dao
[INFO] com.zuoxiaolong.blog:blog-service
[INFO] com.zuoxiaolong.blog:blog-api
[INFO] com.zuoxiaolong.blog:blog-sdk
[INFO] com.zuoxiaolong.blog:blog-web
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.zuoxiaolong.blog:everyone-java-blog 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ everyone-java-blog >>>
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ everyone-java-blog <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ everyone-java-blog ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.zuoxiaolong.blog:blog-common 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ blog-common >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ blog-common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yogesh/Documents/everyone-java-blog-master/blog-common/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ blog-common ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ blog-common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yogesh/Documents/everyone-java-blog-master/blog-common/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ blog-common ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ blog-common ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ blog-common ---
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ blog-common <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ blog-common ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.zuoxiaolong.blog:blog-model 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ blog-model >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ blog-model ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yogesh/Documents/everyone-java-blog-master/blog-model/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ blog-model ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ blog-model ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yogesh/Documents/everyone-java-blog-master/blog-model/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ blog-model ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ blog-model ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ blog-model ---
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ blog-model <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ blog-model ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.zuoxiaolong.blog:blog-dao 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ blog-dao >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ blog-dao ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 12 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ blog-dao ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ blog-dao ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ blog-dao ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ blog-dao ---
[INFO] Surefire report directory: /home/yogesh/Documents/everyone-java-blog-master/blog-dao/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ blog-dao ---
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ blog-dao <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ blog-dao ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.zuoxiaolong.blog:blog-service 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ blog-service >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ blog-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ blog-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ blog-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ blog-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ blog-service ---
[INFO] Surefire report directory: /home/yogesh/Documents/everyone-java-blog-master/blog-service/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ blog-service ---
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ blog-service <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ blog-service ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.zuoxiaolong.blog:blog-api 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ blog-api >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ blog-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ blog-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ blog-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yogesh/Documents/everyone-java-blog-master/blog-api/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ blog-api ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ blog-api ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ blog-api ---
[INFO] Packaging webapp
[INFO] Assembling webapp [blog-api] in [/home/yogesh/Documents/everyone-java-blog-master/blog-api/target/java-blog-api]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/yogesh/Documents/everyone-java-blog-master/blog-api/src/main/webapp]
[INFO] Webapp assembled in [45 msecs]
[INFO] Building war: /home/yogesh/Documents/everyone-java-blog-master/blog-api/target/java-blog-api.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ blog-api <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ blog-api ---
[INFO] Deploying war to http://localhost:8080/java-blog-api  
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] com.zuoxiaolong.blog:everyone-java-blog ............ SUCCESS [  0.334 s]
[INFO] com.zuoxiaolong.blog:blog-common ................... SUCCESS [  0.415 s]
[INFO] com.zuoxiaolong.blog:blog-model .................... SUCCESS [  0.032 s]
[INFO] com.zuoxiaolong.blog:blog-dao ...................... SUCCESS [  0.455 s]
[INFO] com.zuoxiaolong.blog:blog-service .................. SUCCESS [  0.178 s]
[INFO] com.zuoxiaolong.blog:blog-api ...................... FAILURE [  0.862 s]
[INFO] com.zuoxiaolong.blog:blog-sdk ...................... SKIPPED
[INFO] com.zuoxiaolong.blog:blog-web ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.591 s
[INFO] Finished at: 2016-09-16T10:36:13+05:30
[INFO] Final Memory: 23M/264M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project blog-api: Cannot invoke Tomcat manager: Connection refused -> [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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :blog-api

1 个答案:

答案 0 :(得分:0)

如果查看tomcat插件的配置,则会设置以下属性。你有相同的属性,例如TOMCAT在8081上收听吗?或者是在不同的端口上。

       <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <path>/</path>
                    <port>8081</port>
                    <uriEncoding>UTF-8</uriEncoding>
                    <contextReloadable>true</contextReloadable>
                </configuration>
            </plugin>
        </plugins>