tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kerber <>
Subject Getting tomcat instance information into webapp
Date Mon, 03 Oct 2005 00:04:21 GMT
This question is part tomcat and part java; I'm running on a Windows 
2000 server.

I have a situation where I am going to need to run multiple instances of 
tomcat on a single machine, listening on different ports, but running 
the same application and hitting a different instance of an identical 
database (same schema, but on a different server).  So what I will need 
to do is be able to tell each instance of the application on its 
respective instance of tomcat which database to hit. 

Can I pass a parameter into tomcat from a conf file based on what port 
that instance of tomcat is listening on, and then get that parameter 
into my application?  If so, how?

Another option is for my application to grab the machine name and port 
that it is handling, and hit a "common" database to get the information 
on what copy of the production to use.  But again, I need my app to be 
able to find port information from tomcat, and I don't know how to do that.

It seems like a 3rd option might be to run each instance of tomcat as a 
service, logged on with different accounts, and use a user DSN instead 
of a system DSN, with the same DSN name, but different connection info.  
Is that possible?

If necessary, I could install multiple instances of my app at different 
context paths, but I still don't know how to tell them to pick up the 
correct database connection info.  I guess I could make a code change in 
the first page they hit, the logon.jsp, for each instance, but I'd 
rather not have to do that unless there really is no other way, because 
that would be easy to screw up when making changes later on...

Any suggestions as to which of the above approaches would be the best, 
or another one I haven't thought of?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message