maven tomcat7:deploy fails with status code:403, ReasonPhrase:Forbidden

空扰寡人 提交于 2019-12-10 17:38:51

问题


I'm using a tomcat maven plugin to deploy my java web app. Now everythings work when i use tomcat 7.0.32, this is my plugin configuration

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
       <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <url>http://localhost:8080/manager/text</url>
                <server>my-tomcat</server>
                <path>/myapp</path>
            </configuration>
</plugin>

my settings.xml configuration

<servers>
   <server>
        <id>my-tomcat</id>
        <username>manager</username>
        <password>pwd</password>
   </server>
</servers>

my tomcat-users.xml

<role rolename="manager-gui"/>
<user username="managerGui" password="pwd" roles="manager-gui"/>

<role rolename="manager-script"/>
<user username="manager" password="pwd" roles="manager-script"/>

while if use a different version of tomcat, for example 7.0.50, i get the following error

code:403, ReasonPhrase:Forbidden

I also try to connect on tomcat 7.0.50 at

 http://localhost:8080/manager/text

and not work, while with the 7.0.32 version i get the authentication pop-up.

Where am I doing wrong?


回答1:


I faced similar issue, solved it by creating settings.xml in C:\Users{userName}\.m2\ with following content <settings> <servers> <server> <id>my-tomcat</id> <username>manager</username> <password>pwd</password> </server> </servers> </settings>

It seems for some reason plugin not picking up credentials from %MAVEN_HOME%/conf/settings.xml and expect it to present in C:\Users{userName}.m2\settings.xml



来源:https://stackoverflow.com/questions/21309252/maven-tomcat7deploy-fails-with-status-code403-reasonphraseforbidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!