Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 7 tomcat-users manager-script example for /deploy

Tags:

tomcat

tomcat7

I'm trying to get manager/deploy working on my new installation of Tomcat 7.0.34, but I keep getting a 403 when I try to deploy by doing a PUT on http://localhost:8080/manager/deploy. I've yet to get this working in Tomcat 7.

conf/server.xml

<?xml version='1.0' encoding='utf-8'?>
<Server>
...
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
          type="org.apache.catalina.UserDatabase"
          description="User database that can be updated and saved"
          factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service>
  ...
    <Engine>
    ...
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>
    </Engine>
  </Service>
</Server>

conf/tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <user username="tomcat" password="redacted" roles="manager-script"/>
</tomcat-users>

I've also tried (with the same result)

conf/tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <role rolename="manager-script"/>
    <user username="tomcat" password="redacted" roles="manager-script"/>
</tomcat-users>

And yes, I've double, triple, quadruple checked that I'm using the correct username and password, as defined in the tomcat-users.xml. I thought this was all I needed. Any ideas?

like image 728
Cody S Avatar asked Jan 08 '13 19:01

Cody S


1 Answers

So, I finally figured it out!

First, all of the settings above are correct (either version of tomcat-users above is correct, but I think the first one is more correct.

It may not have been clear, originally, but I was migrating from Tomcat 6. What I was missing was the URL that I was PUTting to. It should have been: http://localhost:8080/manager/**text**/deploy

Now everything works great. I hope this helps somebody in the future :)

like image 180
Cody S Avatar answered Sep 17 '22 09:09

Cody S