How to locate external configuration file
From: Alexander Kienzle (nospam_at_nomail.com)
Date: 07/20/04
- Next message: ccwork: "java.lang.outofmemory"
- Previous message: Mark A. Washburn: "VHDL SPICE micro-compiler software engineer with heavy AI training"
- Next in thread: Merrill: "Re: How to locate external configuration file"
- Reply: Merrill: "Re: How to locate external configuration file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 20 Jul 2004 12:49:48 +0200
I'm new to Java programming. I'm developing a Servlet for tomcat which needs
an external configuration file. With external I mean a file (in XML format)
which
is customizable and not contained in my package. I don't want to hardcode
any
path and I would like to be independent of the application server (tomcat,
websphere,...).
Until now, I put the file in my package and open it using
obj.getClass.getResourceAsStream
but when I put my whole package in a .jar file, it prevents that the file is
customizable
(or the .jar file would have to be unpacked on each installation).
Putting any path in the web.xml has the same problem.
The article @ javaworld
(http://www.javaworld.com/javaworld/jw-04-1999/jw-04-cooltools.html)
didn't help because the JDBC connection string actually belongs into the
configuration file.
Also defining a system property when starting tomcat (-Dparam=value) is not
a very good
option as it complicates work for the IT manager (already complicate with
JAAS,
required changes in tomcat's catalina.policy,...).
Someone got any experience how to easily configure a servlet, keep the
configuration
customizable (the configuration itself as well as the location of the
configuration file) and
how to locate the configuration file in a file-system- and
application-server-independent way?
Many thanks
Alex
- Next message: ccwork: "java.lang.outofmemory"
- Previous message: Mark A. Washburn: "VHDL SPICE micro-compiler software engineer with heavy AI training"
- Next in thread: Merrill: "Re: How to locate external configuration file"
- Reply: Merrill: "Re: How to locate external configuration file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]