You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Markus Blaurock <bl...@dig.de> on 2000/06/23 11:21:01 UTC

i18n resources-file, problem isolated !

Heyaho, the problem is isolated!

Reproducable with the struts-example
and tomcat 3.1 under Linux jdk, 1.2.2 from Sun.

The directories are the problem:

if you put the *.properties file directly
below WEB-INF/classes, and say in your
web.xml file 
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>

(leaving off the org.xxx.xxx.xxx part)

then you get 2 phenomenons:

1. struts doesn't find the file anymore..
2. the output when starting tomcat ist shorter.
   Stuts doesn't print any debugging info..

Now i think this isn't a struts problem anymore.
Anyone from tomcat-dev reading this ?


--
markus




-- 
gruss
markus
 

Re: i18n resources-file, problem isolated !

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Marius Sorin Barduta wrote:

> > I don't know why, but it seems
> > the properties file will get loaded
> > from the same 'area' where the
> > class comes from, which does the ResourceBundle.getBundle
> > call.
>
> That is, AFAIK, because there are different Class Loaders for classpath and
> for each context.
> Am I right?
>
> Marius

That is correct.  Tomcat, and other servlet containers that implement 2.2, will
define a special class loader for each web application, which (among other
things) loads classes (and resources) from the WEB-INF/classes and WEB-INF/lib
directories for that web application.  If you are curious, you can look at the
Javadocs for "java.lang.ClassLoader" to see what a class loader has to be able
to do.

I can tell you from experience (my "day job" at Sun is working on Tomcat) that
getting resource loading in a class loader to work correctly is pretty
intricate.  I'm still investigating this problem area, but don't have a general
solution to offer yet.  One thing that makes this interesting to figure out is
that the current Struts code works fine for me on two platforms (Windows98+Sun
JDK 1.2.2_05 and RedHat 6.1 + Sun JDK 1.2.2-L), using either the standard
Tomcat 3.1 release or the most current stuff from the CVS repository.  It's
harder to debug problems when you can't reproduce them :-(.

Craig





Re: i18n resources-file, problem isolated !

Posted by Marius Sorin Barduta <ma...@necomm.ro>.
> I don't know why, but it seems
> the properties file will get loaded
> from the same 'area' where the
> class comes from, which does the ResourceBundle.getBundle
> call.

That is, AFAIK, because there are different Class Loaders for classpath and
for each context.
Am I right?

Marius



Re: i18n resources-file, problem isolated !

Posted by Markus Blaurock <bl...@dig.de>.
forget everything, please.

the problem is another one:
I had struts.jar in my classpath
when starting tomcat  !  (blaeh) :-(

I don't know why, but it seems
the properties file will get loaded
from the same 'area' where the 
class comes from, which does the ResourceBundle.getBundle
call.

sorry.

--
markus