自动部署Tomcat错误排除

1.Connection refused错误html

报错信息以下:web

[ERROR]Failed to execute goal org.apache.tomcat.maven: tomcat7-maven-plugin: 2.0- SNAPSHOT: deploy (default-cli) on project helloworld: Cannot invoke Tomcat manager: Connection refused: connect -> [Help 1]

缘由:未启动Tomcat服务器apache

解决办法:先启动Tomcat服务器再选择Runtomcat

2. 401错误服务器

报错信息以下:app

[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin: 2.0-SNAPSHOT:deploy (default-cli) on project helloworld: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/text/deploy?path=%2Fhelloworld -> [Help 1]

缘由:权限问题webapp

解决办法在$CATALINA_BASE/conf/tomcat-users.xml,maven

如D:\apache-tomcat-7.0.34\conf\tomcat-users.xml文件中添加权限ui

<role rolename=”manager”/>
<user username=”admin” password=”admin” roles=”manager”/>

修改pom.xml文件,在<configuration>  url

</configuration>中添加

<username>admin</username>  
<password>admin</password>

3.403错误

报错信息以下:

[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin: 2.0-SNAPSHOT:deploy (default-cli) on project helloworld: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/html/deploy?path=%2Fhelloworld -> [Help 1]

缘由:产生该问题有可能由于两个缘由,具体参看法决办法

解决办法:

1)若是使用的是Tomcat 7,须要修改pom.xml中部署的url地址,将

<url>http://localhost:8080/manager</url>

<url>http://localhost:8080/manager/text</url>

在此次部署的问题上,我就是遇到了url 的问题,我用的是tomcat7

2)给tomcat用户权限分配上,须要同时具有manager-gui和manager-script权限

正确的conf/tomcat-users.xml配置应为:

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

四、上传war 包过大错误 ---感谢 5楼 杨木祥 童鞋的提供

配置正确的状况下,由包太大,超过默认的50M,致使上传失败。
查看manager log发现,报如下异常:

SEVERE: HTMLManager: FAIL - Deploy Upload Failed, Exception: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (74072771) exceeds the configured maximum (52428800)

解决方案
修改/webapps/manager/WEB-INF/web.xml中,

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

能够解决。

相关文章
相关标签/搜索