Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes Tomcat stop issue using ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat stop issue using ant " Watch "Tomcat stop issue using ant " New topic
Author

Tomcat stop issue using ant

Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Hi All,

I am getting the following exceptions when i ran tomcat-stop ant task. I am using jdk 1.6. Please help me over this.

<target name="tomcat-stop">
<java jar="/${Tomcat5}/bin/bootstrap.jar"
fork="true"
jvm="/usr/bin/java" >
<arg value="-stop"/>
</java>
</target>


tomcat-stop:
Executing '/usr/bin/java' with arguments:
'-jar'
'/opt/Tumri/ics/current/tomcat5/bin/bootstrap.jar'
'-stop'

The ' characters around the executable and arguments are
not part of the command.
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:222)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:410)

Thanks,
Ajay.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42373
    
  64
You need to add the jar file that contains the missing class to your classpath. (bootstrap.jar is very small; it contains only a tiny part of Tomcat.)


Ping & DNS - my free Android networking tools app
Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Thank you Ulf for your quick reply.

I have added the classpath attribute and tried with other options still i find no progress.

Can you please provide any other ant task which i can run the tomcat.

Thank,
Ajay.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42373
    
  64
What does "no progress" mean? Are you saying you added the jar file that contains the missing class, and now you're getting the exact same exception? TellTheDetails
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

If you look in 'bootstrap.jar/META-INF/MANIFEST.MF' you will find this line this means that you need these jars ind your classpath.

In my version of Tomcat (v6.0.18) I don't have 'commons-logging-api.jar' and 'tomcat-coyote.jar' - so I think that these two jars can be left out - in my case.

But look inside YOUR version of Tomcat's bootstrap.jar and see what your dependencies are.
[ September 10, 2008: Message edited by: Rene Larsen ]

Regards, Rene Larsen
Dropbox Invite
Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Thank you for all your replies.

I had seen all are in classapath. I could able to start the server by putting catalina.base.home pointing to tomcat home dir.
Server is starting and i configured in ant java spawn mode, it could able to open and run it , but stopping server, it is not reporting any thing...when i see the ps in linux it is running still...i am not sure of reason... please help me over this.

Thank you!!!

Thanks,
Ajay.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

These is the start and stop task i 'catalina.sh', I think that you need to do like this in you ANT script.
[ September 10, 2008: Message edited by: Rene Larsen ]
Ajay Vikas
Ranch Hand

Joined: Nov 08, 2006
Posts: 66
Thank you Rene.

I have used the exec task and called stop script of the tomcat. It has worked. But still using java task to call start/stop of tomcat would be great!!!

Thank you for all your help!!!

Regards,
Ajay.
SCJP 1.4.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat stop issue using ant