> From: Mike O'Leary [mailto:tmole...@uw.edu] 
> Subject: Calling Bootstrap.main from a Java program

> When I tried this running my Java program in Eclipse, the call 
> to Bootstrap.main(new String[]{"start"}) did not return.

The thread that calls Bootstrap.main() ends up waiting for input on the 
shutdown port - which a thread dump would easily show you.

> running startup.bat in a command prompt window gets Tomcat 
> running and then returns to a command prompt.

You appear to have missed that startup.bat kicks off catalina.bat in a separate 
process.

> Is there a way to call Bootstrap.main(new String[]{"start"}) 
> in an application's main thread so that it returns and Tomcat
> continues running?

You shouldn't really be doing it that way, but disabling the shutdown port in 
your server.xml might work.  

> What is the best way to start and stop Tomcat programmatically from
> a Java application? If it is better to do it using a different class,
> such as Tomcat or Embedded, could someone point me to information 
> about how to do that?

Use the Tomcat class; Embedded is deprecated.  Read the Javadoc for 
org.apache.catalina.startup.Tomcat.  You could also try launching Tomcat in a 
separate process, rather than inside the JVM you're already using.

> I tried using the Tomcat class recently and I couldn't get it to 
> work either.

Can't provide help without specifics.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to