Peter,

> 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:

  <GlobalNamingResources>

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

    .
    .
    .
  </GlobalNamingResources>

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.

-chris


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to