jQuery in Action, 3rd edition
The moose likes Tomcat and the fly likes Start Tomcat 6 from Ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Start Tomcat 6 from Ant" Watch "Start Tomcat 6 from Ant" New topic

Start Tomcat 6 from Ant

Manuel Vargas

Joined: Aug 01, 2008
Posts: 2

I'am working with ant and I defined a task that starts the tomcat bootstrap:

<target name="tomcat-start">
<java jar="C:/Program Files/Apache Software Foundation/Tomcat 6.0/bin/bootstrap.jar"
jvm="C:/Program Files/Java/jdk1.5.0_14/bin/java.exe" >
<arg value="-start"/>
<jvmarg value=
"-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 6.0
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 6.0
-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 6.0\common\endorsed
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\logging.properties -Xdebug -Xrunjdwp:transport=dt_socket,address=1040,server=y,suspend=n"/>

But the problem arise when I run the ant with eclipse 3.3. THe console shows:

Buildfile: C:\Docum....workspace\Selenium Tests\build.xml
[java] java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:215)
[java] at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:390)

Why? I can�t find the solution...
I would be very grateful is someone who have the same experience tell me some information.

Thanks much.

arun nohwar

Joined: Aug 05, 2008
Posts: 16
Because the class org.apache.catalina.startup.Catalina is present in catalina.jar.
You will need to setup the classpath containing all jar files in <CatalinaHome> using classpath attribute of ant task java.
Manuel Vargas

Joined: Aug 01, 2008
Posts: 2
thank arun,
I will add the classpath.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63340

"mdvr vr", please check your private messages for an important administrative matter.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Start Tomcat 6 from Ant
It's not a secret anymore!