Maven Tomcat插件:无法部署到服务器

0xFF

我的环境:Windows 8.1-> Tomcat 7.0.59-> Maven 3.2.5。

我有一个现成的项目,可以编译,获取war文件,复制到%TOMCAT_HOME%\ webapps,启动Tomcat并运行我的应用程序,所有工作正常。但是我要设置自动部署。我在pom.xml中添加了一个插件

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>${tomcat.version}</version>
    <configuration>
        <url>http://localhost:8080/manager/html</url>
        <server>MyTomcat</server>
        <path>/foxrestful</path>
    </configuration>
</plugin>

然后在%TOMCAT_HOME%\ conf \ tomcat-users.xml中添加:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
    <role rolename="manager-gui"/>
    <role rolename="admin-gui"/>
    <role rolename="manager-script"/>
    <role rolename="manager"/>
    <user username="admin" password="11qqsd" roles="admin-gui,admin,manager,manager-gui,manager-script,manager-jmx,manager-status"/>    
</tomcat-users>

%MAVEN_HOME \ conf \ settings.xml%C:\ Users \%USERNAME%\。m2 \ settings.xml中

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>   
    <server>
        <id>MyTomcat</id>
        <username>admin</username>
        <password>11qqsd</password>
    </server>
  </servers>
  <mirrors>
  </mirrors>  
  <profiles>
  </profiles>
</settings>

然后在pom.xml文件中添加一个Maven Tomcat插件

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <url>http://localhost:8080/manager/html</url>
        <server>MyTomcat</server>
        <path>/foxrestful</path>
    </configuration>
</plugin>

要检查我启动Tomcat的设置,请打开http:// localhost:8080 / manager / html,输入登录名:admin,密码:11qqsd,然后Tomcat向我显示管理器应用程序面板。这是工作!

当我在控制台中执行

mvn tomcat7:deploy

我得到:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building foxrestful 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) > package @ foxrestful >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ foxrestful ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ foxrestful ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ foxrestful ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory e:\Compilers\Projects\Java\JerseyRESTful\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ foxrestful ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ foxrestful ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.6:war (default-war) @ foxrestful ---
[INFO] Packaging webapp
[INFO] Assembling webapp [foxrestful] in [e:\Compilers\Projects\Java\JerseyRESTful\target\foxrestful]
[INFO] Processing war project
[INFO] Copying webapp resources [e:\Compilers\Projects\Java\JerseyRESTful\src\main\webapp]
[INFO] Webapp assembled in [170 msecs]
[INFO] Building war: e:\Compilers\Projects\Java\JerseyRESTful\target\foxrestful.war
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) < package @ foxrestful <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @ foxrestful ---
[INFO] Deploying war to http://localhost:8080/foxrestful  
Uploading: http://localhost:8080/manager/html/deploy?path=%2Ffoxrestful
2/11111 KB   
4/11111 KB   
6/11111 KB   
8/11111 KB   
10/11111 KB   
12/11111 KB   
14/11111 KB   
16/11111 KB   
18/11111 KB   
20/11111 KB   
22/11111 KB   
24/11111 KB   
26/11111 KB   
28/11111 KB   
30/11111 KB   
32/11111 KB   
34/11111 KB   
36/11111 KB   
38/11111 KB   
40/11111 KB   
42/11111 KB   
44/11111 KB   
46/11111 KB   
48/11111 KB   
50/11111 KB   
52/11111 KB   
54/11111 KB   
56/11111 KB   
58/11111 KB   
60/11111 KB   
62/11111 KB   
64/11111 KB   
66/11111 KB   
68/11111 KB   
70/11111 KB   
72/11111 KB   
74/11111 KB   
76/11111 KB   
78/11111 KB   
80/11111 KB   
82/11111 KB   
84/11111 KB   
86/11111 KB   
88/11111 KB   
90/11111 KB   
92/11111 KB   
94/11111 KB   
96/11111 KB   
98/11111 KB   
100/11111 KB   
102/11111 KB   
104/11111 KB   
106/11111 KB   
108/11111 KB   
110/11111 KB   
112/11111 KB   
114/11111 KB   
116/11111 KB   
118/11111 KB   
120/11111 KB   
122/11111 KB   
124/11111 KB   
126/11111 KB   
128/11111 KB   
130/11111 KB   
132/11111 KB   
134/11111 KB   
136/11111 KB   
138/11111 KB   
140/11111 KB   
142/11111 KB   
144/11111 KB   
146/11111 KB   
148/11111 KB   
150/11111 KB   
152/11111 KB   
154/11111 KB   
156/11111 KB   
158/11111 KB   
160/11111 KB   
162/11111 KB   
164/11111 KB   
166/11111 KB   
168/11111 KB   
170/11111 KB   
172/11111 KB   
174/11111 KB   
176/11111 KB   
178/11111 KB   
180/11111 KB   
182/11111 KB   
184/11111 KB   
186/11111 KB   
188/11111 KB   
190/11111 KB   
192/11111 KB   

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/html/deploy?path=%2Ffoxrestful
2/11111 KB   
4/11111 KB   
6/11111 KB   
8/11111 KB   
10/11111 KB   
12/11111 KB   
14/11111 KB   
16/11111 KB   
18/11111 KB   
20/11111 KB   
22/11111 KB   
24/11111 KB   
26/11111 KB   
28/11111 KB   
30/11111 KB   
32/11111 KB   
34/11111 KB   
36/11111 KB   
38/11111 KB   
40/11111 KB   
42/11111 KB   
44/11111 KB   
46/11111 KB   
48/11111 KB   
50/11111 KB   
52/11111 KB   
54/11111 KB   
56/11111 KB   
58/11111 KB   
60/11111 KB   
62/11111 KB   
64/11111 KB   
66/11111 KB   
68/11111 KB   
70/11111 KB   
72/11111 KB   
74/11111 KB   
76/11111 KB   
78/11111 KB   
80/11111 KB   
82/11111 KB   
84/11111 KB   
86/11111 KB   
88/11111 KB   
90/11111 KB   
92/11111 KB   
94/11111 KB   
96/11111 KB   
98/11111 KB   
100/11111 KB   
102/11111 KB   
104/11111 KB   
106/11111 KB   
108/11111 KB   
110/11111 KB   
112/11111 KB   
114/11111 KB   
116/11111 KB   
118/11111 KB   
120/11111 KB   

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/html/deploy?path=%2Ffoxrestful
2/11111 KB   
4/11111 KB   
6/11111 KB   
8/11111 KB   
10/11111 KB   
12/11111 KB   
14/11111 KB   
16/11111 KB   
18/11111 KB   
20/11111 KB   
22/11111 KB   
24/11111 KB   
26/11111 KB   
28/11111 KB   
30/11111 KB   
32/11111 KB   
34/11111 KB   
36/11111 KB   
38/11111 KB   
40/11111 KB   
42/11111 KB   
44/11111 KB   
46/11111 KB   
48/11111 KB   
50/11111 KB   
52/11111 KB   
54/11111 KB   
56/11111 KB   
58/11111 KB   
60/11111 KB   
62/11111 KB   
64/11111 KB   
66/11111 KB   
68/11111 KB   
70/11111 KB   
72/11111 KB   
74/11111 KB   
76/11111 KB   
78/11111 KB   
80/11111 KB   
82/11111 KB   
84/11111 KB   
86/11111 KB   
88/11111 KB   
90/11111 KB   
92/11111 KB   
94/11111 KB   
96/11111 KB   
98/11111 KB   
100/11111 KB   
102/11111 KB   
104/11111 KB   
106/11111 KB   
108/11111 KB   
110/11111 KB   
112/11111 KB   
114/11111 KB   
116/11111 KB   
118/11111 KB   
120/11111 KB   
122/11111 KB   
124/11111 KB   
126/11111 KB   
128/11111 KB   
130/11111 KB   
132/11111 KB   
134/11111 KB   
136/11111 KB   
138/11111 KB   
140/11111 KB   

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/html/deploy?path=%2Ffoxrestful
2/11111 KB   
4/11111 KB   
6/11111 KB   
8/11111 KB   
10/11111 KB   
12/11111 KB   
14/11111 KB   
16/11111 KB   
18/11111 KB   
20/11111 KB   
22/11111 KB   
24/11111 KB   
26/11111 KB   
28/11111 KB   
30/11111 KB   
32/11111 KB   
34/11111 KB   
36/11111 KB   
38/11111 KB   
40/11111 KB   
42/11111 KB   
44/11111 KB   
46/11111 KB   
48/11111 KB   
50/11111 KB   
52/11111 KB   
54/11111 KB   
56/11111 KB   
58/11111 KB   
60/11111 KB   
62/11111 KB   
64/11111 KB   
66/11111 KB   
68/11111 KB   
70/11111 KB   
72/11111 KB   
74/11111 KB   
76/11111 KB   
78/11111 KB   
80/11111 KB   
82/11111 KB   
84/11111 KB   
86/11111 KB   
88/11111 KB   
90/11111 KB   
92/11111 KB   
94/11111 KB   
96/11111 KB   
98/11111 KB   
100/11111 KB   
102/11111 KB   
104/11111 KB   
106/11111 KB   
108/11111 KB   
110/11111 KB   
112/11111 KB   
114/11111 KB   
116/11111 KB   
118/11111 KB   
120/11111 KB   
122/11111 KB   
124/11111 KB   
126/11111 KB   
128/11111 KB   
130/11111 KB   
132/11111 KB   

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.210 s
[INFO] Finished at: 2015-03-18T17:28:50+03:00
[INFO] Final Memory: 15M/210M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project foxrestful: Cannot invoke Tomcat manager: Connection reset by peer: socket write error -> [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

谁能说我做错了什么?谢谢。

用户名

尝试使用http:// localhost:8080 / manager / text代替http:// localhost:8080 / manager / html

另外,不应同时向用户授予manager-gui,manager-script角色。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Artifactory Maven插件无法部署

gwt maven插件部署到独立的tomcat无法加载

Maven如何将战争部署到远程Tomcat或Jetty服务器

从Maven存储库部署到销毁服务器

Maven部署到Tomcat

在服务器(Tomcat 7)上部署时,Maven API不响应

无法部署我的Web应用程序(Spring MVC,Tomcat Server,Maven,IntelliJ)

jboss-as-maven-plugin无法部署到远程JBoss AS7?

如何从Eclipse将Maven Project的WAR部署到JBoss服务器?

从Maven 3部署到Nexus OSS 2.12服务器

如何通过Maven将Java jar文件部署到远程服务器

使用Maven将OSB项目部署到服务器

Maven tomcat 插件 - 无法调用 Tomcat 管理器

启动Maven Wildfly插件时发生异常:服务器在60秒内无法启动

Maven的:部署本地项目与依赖远程服务器

由于服务器拒绝了连接,因此无法部署到Heroku

使用Maven更新Spring框架版本后,Eclipse的Tomcat服务器将无法启动

maven:无法为tomcat服务器覆盖server.port

Azure Pipeline无法部署Maven应用引擎

将带有Glassfish的Maven RESTful Web服务项目部署到Ubuntu服务器

Spring / Maven本地主机前缀(tomcat服务器)

部署到应用程序服务器中正确的maven2阶段是什么?

maven.build.timestamp无法解析部署到tomcat的Maven Eclipse构建

Maven插件的部署问题

将Maven项目部署到tomcat

如何将SASS插件目标绑定到tomcat7部署阶段(Maven)

Spring,Maven:无法使用tomcat部署模块

Maven Tomcat部署失败

Tomcat 9的Maven插件