Subject | Re: Error Messages and Interclient Incompatabilities |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-03-07T15:25:23Z |
Hi Ian,
() method with this code:
/**
* This method initializes the messages map.
* @todo think about better exception handling.
*/
private static void init() {
try {
ClassLoader cl = GDSException.class.getClassLoader();
String res = MESSAGES.replace('.','/') + ".properties";
java.io.InputStream in = cl.getResourceAsStream(res);
if (in == null) {
cl = Thread.currentThread().getContextClassLoader();
in = cl.getResourceAsStream(res);
}
if (in != null)
messages.load(in);
} catch (Exception ex) {
if (log!=null) log.info(
"Exception in init of GDSExceptionHelper", ex);
} finally {
initialized = true;
}
}
It seems that for webservers we should use context classloader...
If this code works, I will add it to the CVS.
Thanks!
Roman
> We are using Jetty 3.1 as our web server (www.mortbay.com). TheCan you modify org.firebird.gds.GDSExceptionHelper by replacing init
> Firebirdsql.jars are placed in the WEB-INF/lib directory. If I
> extract the *.properties file from the jar and put them in the WEB-
> INF/classes directory the error messages appear.
>
> Thats about all I can say at the moment. How do I find out what
> classloader I am using?
() method with this code:
/**
* This method initializes the messages map.
* @todo think about better exception handling.
*/
private static void init() {
try {
ClassLoader cl = GDSException.class.getClassLoader();
String res = MESSAGES.replace('.','/') + ".properties";
java.io.InputStream in = cl.getResourceAsStream(res);
if (in == null) {
cl = Thread.currentThread().getContextClassLoader();
in = cl.getResourceAsStream(res);
}
if (in != null)
messages.load(in);
} catch (Exception ex) {
if (log!=null) log.info(
"Exception in init of GDSExceptionHelper", ex);
} finally {
initialized = true;
}
}
It seems that for webservers we should use context classloader...
If this code works, I will add it to the CVS.
Thanks!
Roman