GeeCON Prague 2014*
The moose likes Tomcat and the fly likes Running Different thread  application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Running Different thread  application" Watch "Running Different thread  application" New topic
Author

Running Different thread application

chetan
Greenhorn

Joined: Aug 13, 2002
Posts: 15
Hi,

WE are using tomcat4.31.1 in which your main application is running on UNIX server.Now some of the thread based application we running separately using command line which is independent of tomcat server. Now i want to run that thread based application when the tomcat server starts i.e onload.

Please can anybody tell me how to make run different thread based application using tomcat server onload event.


Thanks in advance

Chetan


Thanks<br />chets
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I would start by reading up on Runtime.exec:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html

And ServletContextListener:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContextListener.html

If the application you need to run is written in Java and you have access to the API (other than the already mentioned command line access) you might want to call it in process right from your webapp.

The context listener won't really run it when Tomcat starts up.
It will run it when the application it is housed in starts up, which may or may not suite your needs.
Another thought is to call it from the Tomcat wrapper scripts.

Without knowing more about this application, it is hard to say which is the best approach from here.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61318
    
  66

"chetan",

You have been warned on at least two previous occasions to change your display name to conform to JavaRanch standards.

This is not optional. Accounts with invalid display names are closed.

Take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post. You will receive no further warnings.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

bear
Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Running Different thread application