I tried using relative paths once. My experience is relative paths
won't work as the "current directory" is whatever the working directory
was on tomcat start. I had to scrap it as it really wasn't consistent
enough to be usable. Something to try might be setting this path using:
(inside the Context element for the webapp)
<Environment name="confPath" value="/path/to/conf/file/or/dir"
type="java.lang.String" override="false"/>
And then call it up in a webapp using a standard JDNI lookup using
'java:comp/env/confPath':
Context initCtx = new InitialContext();
String confFilePath = (String) initCtx.lookup("java:comp/env/confPath");
// Open the file using standard java.io methods and the path retrieved
above here
--David
Caldarale, Charles R wrote:
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Subject: Access a config file located outsite j2ee app
[SEC=UNOFFICIAL]
1. The commented line
env.put(Context.PROVIDER_URL,
"file:C:\\confluence\\confluence-2.5.1-std\\conf");
Not sure this will work (or even if it's a good idea), but you might try
a relative path with forward slashes (which is what the JVM uses
internally anyway):
"file:../conf"
Since Tomcat's normal working directory is bin - at the same directory
level as conf - this may work.
2. Can I somehow set the context to look into the conf
directory of Tomcat without hard coding the path
You could set a context parameter or an environment entry:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html%20Context%20
Parameters
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html%20Environmen
t%20Entries
either in the <Context> element or in WEB-INF/web.xml, again using a
relative path.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]