Hi I'm wanting to store a config file for my J2ee app, somewhere on a
tomcat server possibly inside the
conf/ directory so that I can update this config file without having to
redeploy the j2ee app every time a change is made.
I've been told I can use JNDI to access this file, but I can't seem to
find any examples or documentation on how I can do this.
I would appreciate any help, or suggestions.
So far I can access the file with this code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
try {
Context ctx = new
InitialContext(prop);
// look up context for
name
//env.put(Context.PROVIDER_URL,
"file:C:\\confluence\\confluence-2.5.1-std\\conf");
File f =
(File)ctx.lookup("/confluence/confluence-2.5.1-std/conf/test.txt");
catch {...}
My problems are:
1. The commented line
env.put(Context.PROVIDER_URL,
"file:C:\\confluence\\confluence-2.5.1-std\\conf");
it says in examples that this should set the dir to look in to the conf
dir but if i change the lookup value to just test.txt it cannot find it.
2. Can I somehow set the context to look into the conf directory of Tomcat
without hard coding the path, as the path could change or be different on
different machines??
**********************************************************************
IMPORTANT: This e-mail is intended for the use of the addressee and may
contain information that is confidential, commercially valuable or subject to
legal or parliamentary privilege. If you are not the intended recipient you
are notified that any review, re-transmission, disclosure, use or dissemination
of this communication is strictly prohibited by several Commonwealth Acts of
Parliament. If you have received this communication in error please notify the
sender immediately and delete all copies of this transmission together with any
attachments.
**********************************************************************