Hi Luis ... see below.

Luis Arias wrote:

> Hello fellow struts users !
>
> I just want to share my experience with installing the struts example
> webapps on the Orion application server.
>
> 1.  Locale problems
>
> The struts example application generated exceptions due to the fact that I'm
> running in the fr_FR default locale.  The first exception was caused by the
> ActionResources.properties file not being found :
>
> 11/08/00 20:22 struts-example: Error preloading servlet
> javax.servlet.UnavailableException: Cannot load internal resources from
> 'org.apache.struts.action.ActionResources'
>  at
> org.apache.struts.action.ActionServlet.initInternal(ActionServlet.java:541)
>  at org.apache.struts.action.ActionServlet.init(ActionServlet.java:287)
>  at javax.servlet.GenericServlet.init(GenericServlet.java)
>  at com.evermind.server.http.HttpApplication.sw(JAX)
>  at com.evermind.server.http.HttpApplication.si(JAX)
>  at com.evermind.server.http.HttpApplication.sr(JAX)
>  at com.evermind.server.http.HttpApplication.r6(JAX)
>  at com.evermind.server.http.HttpApplication.<init>(JAX)
>  at com.evermind.server.Application.q_(JAX)
>  at com.evermind.server.http.dq.q_(JAX)
>  at com.evermind.server.http.dp.j9(JAX)
>  at com.evermind.server.http.dm.o9(JAX)
>  at com.evermind.server.http.dm.o8(JAX)
>  at com.evermind.util.e.run(JAX)
>
> I solved the problem by putting a copy of the ActionResources.properties
> file in
> /WEB-INF/classes/org/apache/struts/action/ActionResources_fr.properties.
>
> Wouldn't it be better to have a lookup that defaults to the
> ActionResources.properties file no matter what the default locale is ?
>

I will have to look at this one.  I would expect java.util.ResourceBundle (which
I'm using to read this file) would do exactly what you describe, according to
it's Javadocs.

>
> 2. Problems with finding the action.xml file
>
> This is a know issue with orion for which the
> getServletContext().getResourceAsStream(config); call doesn't go into
> WEB-INF.  I modified the web.xml mapping for the taglib to point to
> /action.xml and moved the file to /action.xml to fix this.
>
> Wouldn't it be better to access this file as in the example Database servlet
> ?
>
>     getServletContext().getRealPath("/") +  "/WEB-INF/database.xml"
>

This approach will only work if your servlet container is actually running the
webapp out of a directory structure.  On containers that run an app directly
from the WAR file (or some other internal organization), getRealPath() will
return null and the above call will not work.

The servlet spec issue that led to this has been clarified --
ServletContext.getResource() is allowed to access static resources from within
WEB-INF -- but the container is not allowed to return these contents directly to
a client.  I understand that the newest version of Orion has been modified to
change this.

>
> 3. Problèmes with the jaxp...
>
> Another exception  seemed to be coming from the java xml api :
>
> C:\orion>java -jar orion.jar
> Orion/1.0.3 initialized
> Digester.getParser:
> org.xml.sax.SAXException: com.sun.xml.parser/P-078 fr_FR
>         at com.sun.xml.parser.Parser.setLocale(Parser.java:172)
>         at
> com.sun.xml.parser.SAXParserFactoryImpl.newParser(SAXParserFactoryImp
> l.java:103)
>         at com.sun.xml.parser.SAXParserImpl.<init>(SAXParserImpl.java:40)
>         at
> com.sun.xml.parser.SAXParserFactoryImpl.newSAXParser(SAXParserFactory
> Impl.java:84)
>         at org.apache.struts.digester.Digester.getParser(Digester.java:288)
>         at org.apache.struts.digester.Digester.parse(Digester.java:748)
>         at
> org.apache.struts.example.DatabaseServlet.load(DatabaseServlet.java:2
> 82)
>         at
> org.apache.struts.example.DatabaseServlet.init(DatabaseServlet.java:1
> 75)
>         at javax.servlet.GenericServlet.init(GenericServlet.java)
>         at com.evermind.server.http.HttpApplication.sw(JAX)
>         at com.evermind.server.http.HttpApplication.si(JAX)
>         at com.evermind.server.http.HttpApplication.sr(JAX)
>         at com.evermind.server.http.HttpApplication.r6(JAX)
>         at com.evermind.server.http.HttpApplication.<init>(JAX)
>         at com.evermind.server.Application.q_(JAX)
>         at com.evermind.server.http.dq.q_(JAX)
>         at com.evermind.server.http.dp.j9(JAX)
>         at com.evermind.server.http.dm.o9(JAX)
>         at com.evermind.server.http.dm.o8(JAX)
>         at com.evermind.util.e.run(JAX)
> Digester.getParser:
> org.xml.sax.SAXException: com.sun.xml.parser/P-078 fr_FR
>         at com.sun.xml.parser.Parser.setLocale(Parser.java:172)
>         at
> com.sun.xml.parser.SAXParserFactoryImpl.newParser(SAXParserFactoryImp
> l.java:103)
>         at com.sun.xml.parser.SAXParserImpl.<init>(SAXParserImpl.java:40)
>         at
> com.sun.xml.parser.SAXParserFactoryImpl.newSAXParser(SAXParserFactory
> Impl.java:84)
>         at org.apache.struts.digester.Digester.getParser(Digester.java:288)
>         at org.apache.struts.digester.Digester.parse(Digester.java:748)
>         at
> org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java
> :619)
>         at
> org.apache.struts.action.ActionServlet.init(ActionServlet.java:291)
>         at javax.servlet.GenericServlet.init(GenericServlet.java)
>         at com.evermind.server.http.HttpApplication.sw(JAX)
>         at com.evermind.server.http.HttpApplication.si(JAX)
>         at com.evermind.server.http.HttpApplication.sr(JAX)
>         at com.evermind.server.http.HttpApplication.r6(JAX)
>         at com.evermind.server.http.HttpApplication.<init>(JAX)
>         at com.evermind.server.Application.q_(JAX)
>         at com.evermind.server.http.dq.q_(JAX)
>         at com.evermind.server.http.dp.j9(JAX)
>         at com.evermind.server.http.dm.o9(JAX)
>         at com.evermind.server.http.dm.o8(JAX)
>         at com.evermind.util.e.run(JAX)
>
> To solve this I run orion in the following manner (on jdk1.2.2)
>
>     java -Duser.language=en -Duser.region=US -jar orion.jar
>

Does this also deal with issue #1 (without your fix), or does that still occur?

>
> On jdk1.3, I placed a copy of
> org/apache/struts/taglib/LocalStrings.properties in
> LocalStrings_fr.properties.
>
> I don't really know what's going on here, maybe a bug in the parser ?
>

It could be ... or it could be related to issue #1.  I will report back on what
I find.

Just out of curiousity, are you using JAXP 1.0.1 (instead of 1.0)?  Also, would
it be possible for you to try this test case with Xerces instead of JAXP?

>
> I hope this information is useful to the struts community...
>
> Cheers,
> --
> Luis Arias
> Elysia - http://www.elysia.com
> 1, rue de Stockholm
> 75008 PARIS
> FRANCE
> +33 1 44 70 70 90
> +33 1 44 70 72 09 fax
> +33 6 14 20 87 93 mobile

Craig McClanahan




Reply via email to