----- Original Message -----
From: "Christopher Chan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 18, 2002 6:00 AM
Subject: Anybody know why tomcat 4.0.1 does not look in the classes
directory for resources?


I have a problem.
I have two webapps running on Tomcat.
The first one has no problems reading from its classes directory for
resource files like .properties
The second one however is throwing missing resource bundle exceptions and
insists it cannot find bundle for base name WEB.
But I do have a WEB.properties file in the second one's classes directory.

The solution? Put the file in the %catalina_home%\classes directory.

But when I try to use the WEB.properties file in jsp for the first webapp,
it ends up reading the one in the %catalina_home%\classes directory!!

Anybody know how to make tomcat get resources for the second webapp from its
classes directory and not fall back to reading the %catalina_home%\classes
directory?
[...]



I am not sure,  I guess java.util.ResourceBundle will ask the
"current-classloader" to begin to
"get Bundle", is it is right, then:

-  in your second webapp(webapp2), if you try to "get Bundle" while the
"current-classloader" is
  "Share-classloader"(you try to "get Bundle" in a object whose Class is
loaded by "Share-classloader"),
 now your WEB.properties(in webapp2's WEB-INF/classes) will not be found
because
"Share-classloader" is "upper" than "webapp2 classloader".

-  in your first webapp(webapp1), if you still have a copy of your
WEB.properties in webapp1's
  WEB-INF/classes while you put another copy of your WEB.properties in
  %CATALINA_HOME%\classes, then becuase in TOMCAT4.0, the webapp-classloader
will
  first try to load class from WEB-INF/classes, then try to load class by
delegating "upper" classloader(s),
  so now the WEB.properties in %CATALINA_HOME%\classes will not be read.

you can find the doc of classloader of TOMCAT4.0 in:
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html
(there are other HOW-TO in:)
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html



Bo
Jan.18, 2002



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to