我尝试将应用程序部署到tomcat7服务器时出错

问题描述 投票:15回答:11

我正在尝试通过eclipse luna将web应用程序部署到tomcat7,但是我收到此错误:

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,但我得到同样的错误。

在我的pom.xml中,我有与此操作相关的配置:

  <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>

谁知道这里发生了什么?

UPDATE

我尝试使用命令mvn:tomcat7 deploy -X部署应用程序,输出是:

[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[\r][\n]"
[DEBUG]  >> "User-Agent: Apache Tomcat Maven Plugin/2.2[\r][\n]"
[DEBUG]  >> "Content-Length: 18783041[\r][\n]"
[DEBUG]  >> "Host: localhost:8080[\r][\n]"
[DEBUG]  >> "Connection: Keep-Alive[\r][\n]"
[DEBUG]  >> "Authorization: Basic dXNlcjAwMToxMjM=[\r][\n]"
[DEBUG]  >> "[\r][\n]"
[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
maven deployment tomcat7
11个回答
15
投票

好吧,我和tomcat7有同样的问题。

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2iplover

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2iplover

[INFO] I/O exception (java.net.SocketException) caught when processing request:         Connection reset
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2iplover

我无法使用它

mvn tomcat7:redeploy 

正如提到的here

我的WAR不是很大,只有4MB。

这是根本问题和解决方案

您的tomcat-users.xml具有正确的角色设置非常重要。我只有manager设置的角色。添加manager-script似乎很重要,完全解决了我的问题。

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

0
投票

就我的AWS amazon实例而言,原因是:

在我的EC2现场实例上,磁盘空间已经完全注意到了99%

我正常使用这个命令使用jenkins

 mvn clean tomcat7:redeploy -Ddeploy.password=xxxAG1
 -Ddeploy.username=admin -Ddeploy.context=/v1 -Ddeploy.url=http://localhost:8080/manager/text

enter image description here

只是释放那个空间,它与我合作。

我遇到的错误是

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset
[INFO] Retrying request


[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.914 s
[INFO] Finished at: 2018-01-10T08:38:28+00:00
[INFO] Final Memory: 47M/371M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:redeploy (default-cli) on project XXXX-app: 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.

提示使用此命令来追踪从(command is from stackoverflow)sudo du -x -d1 -h /你的空间吃什么


0
投票

(重新)使用Maven tomcat插件进行部署也失败了,客户端上的连接重置和Tomcat 8.5.30上的localhost_access.log中的403状态代码也失败了。

这个Tomcat版本的管理器应用程序默认配置了RemoteAddrValve,限制了对localhost的/ manager / *路径的访问。见$TOMCAT_HOME/webapps/manager/META-INF/context.xml

它帮助turn on the logging找到the solution to this


12
投票

我不知道是否有人解决了这个问题。我在我的案例中找到了一种解决方法:使用redeploy而不是部署工作正常。

问题可能与内存问题或读/写访问有关吗?


10
投票

你的战争规模是多少?也许是因为尺寸太大了。默认情况下,tomcat管理器只允许小于50MB的大小战争。也尝试mvn tomcat7:重新部署而不是部署。

See here how to increase the war size limit


10
投票

默认情况下,Tomcat的最大上载大小为50MB。 (即最大尺寸的WAR文件)

如果您需要更大的文件,请尝试在tomcat max-file-size中增加max-request-sizeweb.xml。注意:这些值都以字节存储。

编辑.../webapps/manager/WEB-INF/web.xml。 (确保文件大小大于您尝试上传的war文件)。即如果你需要80MB WAR,

  <max-file-size>82914560</max-file-size>
  <max-request-size>82914560</max-request-size>

然后重启apache tomcat。

https://octopus.com/blog/tomcat-manager-deployment


7
投票

我遇到了同样的问题,并通过运行maven目标解决了这个问题

tomcat7:重新部署

代替

tomcat7:部署

它适用于tomcat7和tomcat8,我的war文件总是低于50mb。


2
投票

检查〜/ .m2 / settings.xml

<settings>
  <servers>
    <server>
      <id>tomcat-manager</id>
      <username>user001</username>
      <password>123</password>
    </server>
  </servers>
</settings>

2
投票

我遇到了同样的问题,在我的情况下,问题是一个不以/开头的cunfigured上下文路径。将上下文路径“myapp”修复为“/ myapp”解决了这个问题。


2
投票

偶尔出问题

如果有时重新部署失败,有时会成功,增加日志记录可能会显示DOS保护。

编辑/conf/logging.properties并添加该行

org.apache.catalina.level = FINEST

在文件的末尾。可能会显示此输出:

FINE [http-nio-8080-exec-7] org.apache.catalina.authenticator.AuthenticatorBase.invoke Security checking request PUT /manager/text/deploy
FINE [http-nio-8080-exec-7] org.apache.catalina.loader.WebappClassLoaderBase.loadClass loadClass(org.apache.catalina.manager.ManagerServlet, false)
FINE [http-nio-8080-exec-7] org.apache.catalina.loader.WebappClassLoaderBase.loadClass   Delegating to parent classloader1 java.net.URLClassLoader@568db2f2
FINE [http-nio-8080-exec-7] org.apache.catalina.loader.WebappClassLoaderBase.loadClass   Loading class from parent
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[Status interface]' against PUT /text/deploy --> false
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[Text Manager interface (for scripts)]' against PUT /text/deploy --> true
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[HTML Manager interface (for humans)]' against PUT /text/deploy --> false
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[JMX Proxy interface]' against PUT /text/deploy --> false
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[Status interface]' against PUT /text/deploy --> false
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[Text Manager interface (for scripts)]' against PUT /text/deploy --> true
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[HTML Manager interface (for humans)]' against PUT /text/deploy --> false
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.findSecurityConstraints   Checking constraint 'SecurityConstraint[JMX Proxy interface]' against PUT /text/deploy --> false
FINE [http-nio-8080-exec-7] org.apache.catalina.authenticator.AuthenticatorBase.invoke  Calling hasUserDataPermission()
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.hasUserDataPermission   User data constraint has no restrictions
FINE [http-nio-8080-exec-7] org.apache.catalina.authenticator.AuthenticatorBase.invoke  Calling authenticate()
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.CombinedRealm.authenticate Attempting to authenticate user [admin] with realm [org.apache.catalina.realm.UserDatabaseRealm]
FINER [http-nio-8080-exec-7] org.apache.catalina.realm.RealmBase.authenticate Username [admin] NOT successfully authenticated
FINE [http-nio-8080-exec-7] org.apache.catalina.realm.CombinedRealm.authenticate Failed to authenticate user [admin] with realm [org.apache.catalina.realm.UserDatabaseRealm]
WARNING [http-nio-8080-exec-7] org.apache.catalina.realm.LockOutRealm.filterLockedAccounts 
     An attempt was made to authenticate the locked user [admin]
FINE [http-nio-8080-exec-7] org.apache.catalina.authenticator.AuthenticatorBase.invoke  Failed authenticate() test
FINE [http-nio-8080-exec-7] org.apache.catalina.core.StandardHostValve.custom Processing ErrorPage[errorCode=401, location=/WEB-INF/jsp/401.jsp]
FINER [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapper.allocate   Returning non-STM instance
FINE [http-nio-8080-exec-7] org.apache.catalina.core.ApplicationDispatcher.doForward  Disabling the response for further output

(在此日志记录中,尝试上载的用户具有用户名admin

正如您在此输出中看到的,用户admin已被锁定:

WARNING [http-nio-8080-exec-7] org.apache.catalina.realm.LockOutRealm.filterLockedAccounts 
  An attempt was made to authenticate the locked user [admin]

看看documentationserver.xml内部你会发现一个

   <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>

使用不可预见的用户名

删除该行是一个坏主意,将重新部署的用户名更改为另一个更不可预见的名称,如deploy355547511,以便不被锁定。


0
投票

我不知道这是否有帮助,但在我的情况下。 tomcat7插件从maven conf settings.xml中选择服务器详细信息,而不是从.m2 \ settings.xml。在该文件中添加服务器信息已解决我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.