Ant Tomcat 7重新加载FileNotFoundException

时间:2011-03-02 04:36:15

标签: java tomcat ant

我正在尝试从ant重新加载Web应用程序。 但我找不到错误:

D:\project\triplelands\ocbcfilesending\src\com.ocbcmcd.monitoring\build.xml:90:
java.io.FileNotFoundException: http://localhost:8080/manager/reload?path=%2Fhello

我也尝试直接访问:http://localhost:8080/manager/reload?path=/hello 我的浏览器收到了404错误代码:

我的配置是:

My Ant Script

<target name="deploy-realod" depends="deploy" description="Reload application in Tomcat">
       <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}" />
</target>

build.properties

appserver.home=C:/appserv/apache6
#for Tomcat 5 use $appserver.home}/server/lib
#for Tomcat 6 use $appserver.home}/lib
appserver.lib=${appserver.home}/lib

deploy.path=${appserver.home}/webapps
tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=root
tomcat.manager.password=root

tomcat用户配置

<user name="root" password="root" roles="admin-gui,manager-gui,tomcat,role1" />

感谢您的建议

3 个答案:

答案 0 :(得分:12)

我也遇到了这个问题,同时将我从Tomcat 6工作的项目移动到Tomcat 7.本质上,管理器URL中有一个更改,它被分成几个,每个依赖的使用关于你如何与它接口:

* /manager/html for the HTML GUI
* /manager/text for the text interface
* /manager/jmxproxy for the JMX proxy
* /manager/status for the status pages

对于ant,您要使用/ manager / text。 那么,您需要编辑build.properties文件,如下所示:

tomcat.manager.url=http://localhost:8080/manager/text

希望有所帮助!

答案 1 :(得分:5)

要使它在Tomcat 7上运行,您需要以下内容 -

的build.xml

<path id="catalina-ant-classpath">
    <!-- We need the Catalina jars for Tomcat -->
    <!--  * for other app servers - check the docs -->
    <fileset dir="${appserver.lib}">
        <include name="catalina-ant.jar"/>
        <include name="tomcat-coyote.jar"/>
        <include name="tomcat-util.jar"/>
        <include name="tomcat-juli.jar"/>
    </fileset>
</path>

build.properties

tomcat.manager.url=http://localhost:8080/manager/text
tomcat.manager.username=tomcat
tomcat.manager.password=s3cret

Tomcat的users.xml中

<user name="tomcat" password="s3cret" roles="manager-script"/>
欢呼,alexi

答案 2 :(得分:1)

tomcat 7.0中的tomcat用户配置应该是这样的:

<role rolename="tomcat"/>
<role rolename="manager"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="standard"/>
  <user username="admin" password="admin" roles="tomcat,manager,standard,manager-script,manager-gui"/>
</tomcat-users>