DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16176>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16176

PropertyMessageResources should load resourcs via 
Thread.currentThread().getContextClassLoader().getResourceAsStream() or 
ServletContext.getResourceAsStream()

           Summary: PropertyMessageResources should load resourcs via
                    Thread.currentThread().getContextClassLoader().getResour
                    ceAsStream() or ServletContext.getResourceAsStream()
           Product: Struts
           Version: 1.0.2 Final
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Utilities
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Imagine an EAR with 3 web-apps.

Each web-app has specific ApplicationResources.properties in WEB-INF/classes

Rather than put struts.jar (and all corresponding jar's) in WEB-INF/lib, you 
put them in the EAR's manifest classpath.  

Imagine that the EAR has hierarchical classloaders so that EAR/manifest 
Classloader is parent of each individual webapp classloader.  This way you can 
reload the web-app's classes without reloading the entire EAR.

So a call initiates to a webapp with a struts action, this to the servlet ends 
up in PropertyMessageResources trying to load these resources via:

            is = this.getClass().getClassLoader().getResourceAsStream(name);
and you end up with the error:

javax.servlet.jsp.JspException: Missing message for key title.MedRec

        at org.apache.struts.taglib.bean.MessageTag.doStartTag()I
(MessageTag.java:298)
        at jsp_servlet.__start._jspService
(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;
)V(__start.java:273)
        at weblogic.servlet.jsp.JspBase.service
(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V
(JspBase.java:33)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
()Ljava.lang.Object;(ServletStubImpl.java:1047)

The problem is that since PropertyMessageResources lives in the parent 
classloader it can't "see" the child webapp classloader.  However if:

PropertyMessageResources loaded esourcs via Thread.currentThread
().getContextClassLoader().getResourceAsStream() it would get be able to 
resolve fine.

The work around is to copy struts and all its jars to each webapp/WEB-INF/lib 
but this makes one feel dirty and unclean.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to