David Mossakowski wrote:
> All the previous answers about loading from properties files and using servlet
> context are valid but I think you mean that you have _physically_ separated servers
> which have physically separated servlet engines attached to them. It is a much
> bigger problem in such a case. The servlet API does not define a way to share stuff
> across JVMs (at least I don't believe it does) so you're stuck with some application
> server that will do it for you.
>
> If you get a good response to this I'd like to know too.
>
Don't assume that, just because you have a hammer, every problem is a nail.
(Translation: just because you are writing servlets, don't assume that you have to use
the servlet API to solve every problem :-). There are quite a few alternative
approaches to this, utilizing facilities inside and outside the servlet API.
* Use a network drive to store shared configuration files, and
make it accessible to each of the servers you run on. That
way, all the JVMs are reading the same data and you only
need to change it once.
* Store the "official" files on one server, and modify the startup
script for your JVMs to go copy the files locally (via FTP or
something like that) whenever they start up.
* Store the configuration information in a directory server,
and access it via LDAP.
* Store the configuration information in a commonly
accessed database, and access it via JDBC.
* Make the config information accessible via an RMI or
CORBA server.
* Put the config files on a web server, and go use a
java.net.URLConnection to read them in the initialization
of your servlet-based application.
* Put the config files on a web server, and configure the
document root of your web application to point at that web
server (instead of to a local directory). Now, you can use
ServletContext.getResource() to access these files. As a
side benefit, this is a good way to share JSP files and
other things when you're using
a server farm with load balancing for your app.
>
> dave.
>
Craig McClanahan
>
> Rehman Habib wrote:
>
> > Hi there,
> >
> > I started looking into JSP around a week ago and I think it has a lot of
> > potential.
> > I have only just subscribed to this forum and trust I will be welcome....
> >
> > Anyway, enough of the babble, does anyone know how (or indeed if is possible) to
> > have a set of global properties which are set when then webserver and tomcat are
> > started ?
> > For example, I work with a global website with multiple webservers and each has
> > a connection to a local database. It would be nice to define the TNS name as a
> > property for each webserver which is then used by the class which performs the
> > connection to the database. If this isn't possible then I would have to hard
> > code it into the class and have a different copy for each webserver - very nasty
> > !!!
> >
> > Regards,
> > Habib
> >
> > ===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> > FAQs on JSP can be found at:
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
>
> --
> David Mossakowski [EMAIL PROTECTED]
> Programmer 212.310.7275
> Instinet Corporation
>
> "I don't sit idly by, I'm planning a big surprise"
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html