users@glassfish.java.net

load properties file in a war context

From: <glassfish_at_javadesktop.org>
Date: Tue, 04 Sep 2007 09:21:23 PDT

Probably a trivial subject, but...

In a war application I try to load some properties files (for logging, ...) in a contained jar.

then I tried several solution and didn't succeed to have some beautiful way to have this working.
in my war structure, my properties files (and my jar library trying to load them) are in :
WEB-INF/lib

According to glassfish documentation, this path is included in class loading path for a web context application.

but with :
- getClass().getClassLoader().getResourceAsStream() it doesn't work
- Thread.currentThread().getContextClassLoader().getResourceAsStream() it doesn't work
- ...

I tried several filename forms : "myfile.properties", "/myfile.properties", "WEB-INF/lib/myfile.properties", ... no way

I'm quite discouraged.
Any help would be greatfull,
thx

thierry

ps : the solution to put this properties files in glassfish/config dir should be avoided
[Message sent by forum member 'tbls' (tbls)]

http://forums.java.net/jive/thread.jspa?messageID=233871