You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Tuukk4 |[:)<-<| p4s4n3n" <il...@lycos.com> on 2001/06/01 08:10:21 UTC

Re: tomcat-4.0 and JSP class reloading

On Thu, 31 May 2001 12:40:34  
 Remy Maucherat wrote:
>Quoting "Craig R. McClanahan" <cr...@apache.org>:
>
>> See below.
>> 
>> On Thu, 31 May 2001, Remy Maucherat wrote:
>> 
>> 
>> I'm not sure this proposed change would really make any difference. 
>> The
>> "parent" classloader here is the web app classloader already, which is
>> the
>> same thing that the context class loader is set to.
>> 
>> NOTE:  If we do something like this, we need to make sure that
>> getResource() and getResourceAsStream() work in JasperLoader as well.
>> 
>> I'll do some more investigation today.
>
>Apparently, the problem was that the parent reference wasn't reset after 
>reloading. So using a dynamic call would solve this.
>
>Remy

hey,
I can show point because i know i have been workin on this problem a while (2 weeks). Main problem is in org.apache.catalina.loader.StandardLoader in setClassLoader() method and there in 

   if (servletContext instanceof ApplicationContext)
   ((ApplicationContext) servletContext).setAttributeReadOnly
   (Globals.CLASS_LOADER_ATTR);

Because this preverts ClassLoader rereshing for Jasper (One can write only once). 

Then we have to 'ReLoad' reloaded ClassLoader in org.apache.jasper.servlet.JspServlet e.g in 
        
       loadJSP(String jspUri, String classpath,
       boolean isErrorPage, HttpServletRequest req,   
       HttpServletResponse res) 

Because Jasper's ClassLoader doesn't point to our new ClassLoader 

URLClassLoader classLoader =
(URLClassLoader)context.getAttribute(Constants.SERVLET_CLASS_LOADER);

if(classLoader != parentClassloader){
 ..Do the securing stuff..
}

and make little If whether it has changed or not. 
this is simpliest Answer and were the 'problem' is.

after this everything has worked for me just fine:)

Tuukka

ps. I can submit a patch:)


Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/