简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM