tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Uniquely identifying an servlet runner instance...
Date Wed, 25 Oct 2006 14:34:48 GMT

> I need to store in our database (along with other information) which
> of our servers that made the save. Is it possibly to dynamically find
> a property that identifies it? Or will I have to have separate
> web.xmls with init parameters that I can use? The purpose is to be
> able to see (in the database) on what server/instance a user is
> logged on.
> The server name is not really enough, we could run multiple Tomcats
> on the same machine.

If you have several instances of Tomcat, you ought to have different
server.xml files for each instance.

You could put a <GlobalNamingParameter> entry into server.xml that
identifies the server. You can get this value out using JNDI at runtime.

The Tomcat 4.1 sample server.xml files contain an example of an Integer
value in the GlobalNamingResources:


    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>


I would imagine that later versions of Tomcat (5.x) would have the same
capability, and that you could adopt this technique to suit your needs.


View raw message