8

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?

4

2 回答 2

9

所以,我终于想通了!

首先,上面的所有设置都是正确的(上面的tomcat-users的任何一个版本都是正确的,但我认为第一个正确。

最初可能不清楚,但我是从 Tomcat 6 迁移的。我缺少的是我要放入的 URL。它应该是: http://localhost:8080/manager/**text**/deploy

现在一切都很好。我希望这对将来的人有所帮助:)

于 2013-01-08T22:12:00.990 回答
0

1st one is the best solution. I faced this problem and solved by adding following lines in tomcat-users.xml file.

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <user username="tomcat" password="redacted" roles="manager-script"/>
</tomcat-users>
于 2018-10-29T10:46:11.113 回答