You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/01/16 19:21:02 UTC

DO NOT REPLY [Bug 16176] New: - PropertyMessageResources should load resourcs via Thread.currentThread().getContextClassLoader().getResourceAsStream() or ServletContext.getResourceAsStream()

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: struts-dev@jakarta.apache.org
        ReportedBy: skarm@niffgurd.com


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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DO NOT REPLY [Bug 16176] New: - PropertyMessageResources should load resourcs via Thread.currentThread().getContextClassLoader().getResourceAsStream() or ServletContext.getResourceAsStream()

Posted by James Mitchell <jm...@apache.org>.
Here we go again.


--
James Mitchell





----- Original Message -----
From: <bu...@apache.org>
To: <st...@jakarta.apache.org>
Sent: Thursday, January 16, 2003 1:21 PM
Subject: DO NOT REPLY [Bug 16176] New: - PropertyMessageResources should
load resourcs via
Thread.currentThread().getContextClassLoader().getResourceAsStream() or
ServletContext.getResourceAsStream()


> 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: struts-dev@jakarta.apache.org
>         ReportedBy: skarm@niffgurd.com
>
>
> 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.HttpServletRespo
nse;
> )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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>