Mike, >> Here's a suggestion: create a new webapp that doesn't actually have any >> servlets. Just create a ContextListener that responds to START and STOP >> requests, and use the listener to startup your services. > > I believe you and Martin are saying the same thing. I could do that however > I would need my jar file to be in $TOMCAT_HOME/shared/lib probably. I can't > have each different web app starting new instances of the services. > Services are only started once be Tomcat Server.
No, in fact it's better if you /don't/ have your JAR file in TOMCAT_HOME/shared/lib: you want a completely separate webapp. You can even put it into a WAR file and drop it into the auto-deploy directory if you have Tomcat to auto-deploy WAR files. In this way, you have a completely portable webapp that simply does not have any servlets running within it. The only trick is to get Tomcat to load that webapp /before/ any other webapps start. One option is to startup a separate instance of Tomcat for the purposes of only hosting this services webapp, and run your other webapps however you wish. You simply have to start the services instance of Tomcat before starting any other instances. This strategy also allows you to bring your services up and down (possibly for an upgrade) without disturbing the dependent webapps. Don't let the term "webapp" get in the way... your services (JMS or something like it?) will be available just as you are accustomed to having them. You are only adding a thin layer (the ContextListener) to get them started within Tomcat -- because it does not have some of the features aforementioned app servers. -chris
signature.asc
Description: OpenPGP digital signature