Im running a couple of servlet applications in Tomcat (5.5). All servlets use the factory share, which is shared with JNDI. At the moment, I can get everything by including the factory resource as the GlobalNamingResource file in the /conf/server.xml file, and then when each servlet of the META-INF / context.xml file includes the ResourceLink in the resource. The following are snippets of XML files. NOTE: I am not familiar with tomcat, so I am not saying that this is a good configuration.
However, now I want these servlets to be able to be installed on multiple tomcat instances automatically using RPM. RPM will first copy WARs to the webapps directory and banks for the factory to the common / lib directory (which is good). But you also need to make sure that the factory resource is included as a resource for all servlets.
What is the best way to add a resource globally? I'm not too keen on writing a script that goes into server.xml and adds to the resource this way. Is there a way to add multiple server.xml files so that I can write a new server-app.xml file and it will concatenate my settings with server.xml? Or is it even better to add this JNDI resource to all servlets without using server.xml?
ps Restarting the server will not be a problem, so I do not mind if the changes are not received automatically.
thanks
Snippet from server.xml
<GlobalNamingResources> <Resource name="bean/MyFactory" auth="Container" type="com.somewhere.Connection" factory="com.somewhere.MyFactory"/> </GlobalNamingResources>
The entire servlet of the META-INF / context.xml file
<?xml version="1.0" encoding="UTF-8"?> <Context> <ResourceLink global="bean/MyFactory" name="bean/MyFactory" type="com.somewhere.MyFactory"/> </Context>
java resources tomcat jndi
Lehane
source share