All my tests worked on Tomcat 7.0.26 , i am sure its will work on older version with minor changes.
You must set a permissions to the tomcat user you want to use, in my case i used the tomcat user.
i changed the tomcat-users.xml file as follow:
<user username="tomcat" password="xxx" roles="manager-gui,admin-gui,manager-script,manager-jmx,manager-status"/>
restart Tomcat
<user username="tomcat" password="xxx" roles="manager-gui,admin-gui,manager-script,manager-jmx,manager-status"/>
restart Tomcat
Option 1 - via ant build file
i used the next build.xml file:
<project name="My Application" default="compile" basedir=".">
<!-- Configure properties to access the Manager application -->
<property name="url" value="http://il-yanivt:8080/manager/text"/>
<property name="username" value="tomcat"/>
<property name="password" value="tomcat"/>
<path id="tomcat.classpath">
<fileset dir="C:/Program Files/Apache Software Foundation/apache-tomcat-7.0.26/lib" includes="*.jar" />
<fileset dir="C:/Program Files/Apache Software Foundation/apache-tomcat-7.0.26/bin" includes="*.jar" />
</path>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="tomcat.classpath" />
</taskdef>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath refid="tomcat.classpath" />
</taskdef>
<target name="stop" description="Stop web application">
<stop url="${url}" username="${username}" password="${password}" path="${site}"/>
</target>
<target name="start" description="Start web application">
<start url="${url}" username="${username}" password="${password}" path="${site}"/>
</target>
</project>
For a complete list of tomcat manager urls - visit the Manager App HOW-TO.
Open command windows , change the directory where is your build.xml file is, and type the next command :
MySite mean your site name.
ant.bat start -Dsite=/MySite
ant.bat stop -Dsite=/MySite
enjoy
Yaniv Tzanany
No comments:
Post a Comment