File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 The Software Craftsman this week in the Agile 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\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\ -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] at Method)
[java] at
[java] at java.lang.ClassLoader.loadClass(
[java] at java.lang.ClassLoader.loadClass(
[java] at org.apache.catalina.startup.Bootstrap.init(
[java] at org.apache.catalina.startup.Bootstrap.main(

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: 62291

"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:
subject: Start Tomcat 6 from Ant