----- Original Message -----
From: "Gerry Scheetz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 17, 2002 12:26 PM
Subject: Multiple instances of a servlet with Tomcat


> I was wondering if it is possible to have the same servlet running twice =
> under a single instance of Tomcat.
>
> I am running Tomcat 3.2, but could upgrade to Tomcat 4.0.
>
> What I want to do is be able to access 2 different databases through the =
> same servlet code.  So http://localhost/ProdApp would run against a =
> production database and http://localhost/TestApp would run against a test
=
> database.  My database connection information is stored in the web.xml =
> file and I assume if this is possible the web.xml file is what I need to =
> manipulate.  I just don't want to spend hours working on this if it is not
=
> possible.
>
> Thanks,
> Gerry
>[...]


I think normally it is possible, in the following:
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html
(there are other HOW-TO in:)
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html

you can find a "classloader map", different wabapp will have different
classloader(webapp-classloader), so normally,  if you put 2 copies of
YourServlet in WEB-INF/classes of differebt webapp, they will be
treated as different Servlet-classes.

but if you have some "cross-webapp" object, and you put a reference
of YourServlet inside such object, or you use "Serializable/Externalizable"
property of YourServlet, perhaps you need to be careful to avoid
ClassCastException or other.


Bo
Jan.17, 2002

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to