问题描述
我正在尝试通过 eclipse luna 将 Web 应用程序部署到 tomcat7,但出现此错误:
I am trying deploy a web application to tomcat7 via eclipse luna, but I am getting this error:
Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.936 s
[INFO] Finished at: 2014-08-15T22:10:04-03:00
[INFO] Final Memory: 13M/112M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project loja: Cannot invoke Tomcat manager: Connection reset -> [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
我也尝试部署到 tomcat8,但我遇到了同样的错误.
I also try deploy to tomcat8, but I get this same error.
在我的 pom.xml 中,我有这个操作相关的配置:
In my pom.xml, I have this configuration related to this operation:
<build>
<finalName>loja</finalName>
<plugins>
<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>/loja</path>
<username>user001</username>
<password>123</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
有人知道这里发生了什么吗?
Anyone knows what's happening here?
更新
我尝试使用命令 mvn:tomcat7 deploy -X
部署应用程序,输出如下:
I try deploy the application with the command mvn:tomcat7 deploy -X
and the output was that:
[INFO] Retrying request
[DEBUG] Reopening the direct connection.
[DEBUG] Connecting to localhost:8080
[DEBUG] Attempt 4 to execute request
[DEBUG] Sending request: PUT /manager/text/deploy?path=%2Floja HTTP/1.1
[DEBUG] >> "PUT /manager/text/deploy?path=%2Floja HTTP/1.1[
][
]"
[DEBUG] >> "User-Agent: Apache Tomcat Maven Plugin/2.2[
][
]"
[DEBUG] >> "Content-Length: 18783041[
][
]"
[DEBUG] >> "Host: localhost:8080[
][
]"
[DEBUG] >> "Connection: Keep-Alive[
][
]"
[DEBUG] >> "Authorization: Basic dXNlcjAwMToxMjM=[
][
]"
[DEBUG] >> "[
][
]"
[DEBUG] >> PUT /manager/text/deploy?path=%2Floja HTTP/1.1
[DEBUG] >> User-Agent: Apache Tomcat Maven Plugin/2.2
[DEBUG] >> Content-Length: 18783041
[DEBUG] >> Host: localhost:8080
[DEBUG] >> Connection: Keep-Alive
[DEBUG] >> Authorization: Basic dXNlcjAwMToxMjM=
Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja
...
[DEBUG] Connection 0.0.0.0:53183<->127.0.0.1:8080 closed
[DEBUG] Closing the connection.
[DEBUG] Connection 0.0.0.0:53183<->127.0.0.1:8080 closed
[DEBUG] Connection 0.0.0.0:53183<->127.0.0.1:8080 shut down
[DEBUG] Connection 0.0.0.0:53183<->127.0.0.1:8080 closed
[DEBUG] Connection released: [id: 0][route: {}->http://localhost:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 5]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.271 s
[INFO] Finished at: 2014-08-16T08:11:09-03:00
[DEBUG] Connection manager is shutting down
[INFO] Final Memory: 14M/109M
[INFO] ------------------------------------------------------------------------
[DEBUG] Connection manager shut down
推荐答案
默认情况下,Tomcat 的最大上传大小为 50MB.(即 WAR
文件的最大大小)
By default Tomcat has a max upload size of 50MB. (I.e max size of WAR
file)
如果您需要更大的文件,请尝试在 tomcat web.xml
中增加 max-file-size
和 max-request-size
.注意:这些值都以字节为单位存储.
If you require larger file, try increasing max-file-size
and max-request-size
within the tomcat web.xml
. Note: those values are both stored in bytes.
编辑 .../webapps/manager/WEB-INF/web.xml
.(确保文件大小大于您尝试上传的 war
文件).即如果您需要 80MB WAR,
Edit .../webapps/manager/WEB-INF/web.xml
. (Ensure the file sizes are larger than the war
file your trying to upload). I.e if you require 80MB WAR,
<max-file-size>82914560</max-file-size>
<max-request-size>82914560</max-request-size>
然后重启apache tomcat.
Then restart apache tomcat.
https://octopus.com/blog/tomcat-manager-deployment
这篇关于尝试将应用程序部署到 tomcat7 服务器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!