Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven tomcat7 plugin authentication fail, 403 Forbidden

I'm posting this after weeks of effort. I try and try because I felt guilty of posting this because there are thread similar to this. But still I'm getting slightly different error. So what I have is a very simple spring(no need to be spring of course bcz problem is with maven) application with maven.

This is plugins section from my pom.

<plugins>

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <url>http://localhost:8080/manager</url>
                <username>tomcat</username>
                <password>s3cret</password>
                <path>/Test</path>
                <port>8080</port>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>

Earlier I have problems with maven tomcat plugin not working with tomcat 7 etc etc but now with "tomcat7-maven-plugin" there are solved. I'm using 'http://localhost:8080/manager' as the URL. For almost all threads about this maven tomcat compiler plugin are about build failure. But my build succeed(I run as tomcat7:deploy). Problem is tomcat is replying

tomcatManager status code:403, ReasonPhrase:Forbidden

along with the html that we see when we got a authentication failure on browser. The same code works fine under my Linux box. I try different scenarios of using server element in settings.xml which is inside .m2 and inside maven_home/conf etc. Still not working.

As I figure out maven cannot authenticate tomcat. username and password is find and I can log in using GUI. So expecting a help here.

p.s - my tomcat-users.xml fiel

<role rolename="manager-gui" />
<user username="tomcat" password="s3cret" roles="manager-gui"/>
like image 537
Susitha Ravinda Senarath Avatar asked Feb 20 '13 06:02

Susitha Ravinda Senarath


1 Answers

Url is not correct try with :

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

what is the content of tomcat-users.xml file. Did you correctly set permissions ? See http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

like image 96
Olivier Lamy Avatar answered Nov 16 '22 00:11

Olivier Lamy