Re: tomcat-4.0 and JSP class reloading
i was litlle un detailed sorry but i try to explain. This can be test with Tomcat 4.0 b6-dev (last week CVS version at least i haven't see this to be fixed) make app dir like test/ then create index.jsp. make some class like test.testIt that context is like package test; public class TestIt public TestIt } public int getNumber(){ return 303 } public String getString(){ return TestString } } and turn reloading on to test/ context then create servlet that uses this Class [test.TestIt] (i think you know how to do it) make it print number and string to HTML page. then do same to index.jsp (i all so think you can do it) then compile these to test/WEB-INF/classes and run tomcat. then Look what you have there (what are outputs) and changes those string and number and recompile classes. after about 15 secs servlet has new context but JSP doesn't. I allready have fix this and submit a patch but now one have replyed anything:) it's just a little bug there.. Tuukka ps. need for more details?? pss. if someone allready has this fixed he/she is really glad because this BUG forces to stop Tomcat and reload it again everytime when Classes that belongs to JSP changes. I have spent to much time waiting:P --- --Me olemme keskella jotain. jossa olemme totaalisen ulkopuolisia-- On Wed, 30 May 2001 10:46:39 Craig R. McClanahan wrote: On Wed, 30 May 2001, Tuukk4 |[:)-| p4s4n3n wrote: hey, Is anyone fixing that point? Problem is that JSP doesn't reload classes when servlet container in same context does? Can you provide a small example that illustrates this? Tuukka Craig McClanahan Get 250 color business cards for FREE! http://businesscards.lycos.com/vp/fastpath/
Re: tomcat-4.0 and JSP class reloading
See below. On Thu, 31 May 2001, Remy Maucherat wrote: i was litlle un detailed sorry but i try to explain. This can be test with Tomcat 4.0 b6-dev (last week CVS version at least i haven't see this to be fixed) and turn reloading on to test/ context then create servlet that uses this Class [test.TestIt] (i think you know how to do it) make it print number and string to HTML page. then do same to index.jsp (i all so think you can do it) then compile these to test/WEB-INF/classes and run tomcat. then Look what you have there (what are outputs) and changes those string and number and recompile classes. after about 15 secs servlet has new context but JSP doesn't. I allready have fix this and submit a patch but now one have replyed anything:) it's just a little bug there.. Tuukka ps. need for more details?? pss. if someone allready has this fixed he/she is really glad because this BUG forces to stop Tomcat and reload it again everytime when Classes that belongs to JSP changes. I have spent to much time waiting:P Ok, I understand the bug a bit better now. To fix it, I would always load the external classes using the thread's context class loader instead of trying to keep an up to date reference on it, using something like : RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/Jasp erLoader.java,v retrieving revision 1.3 diff -r1.3 JasperLoader.java 174c174 // Class is in a package, delegate to parent --- // Class is in a package, delegate to thread context class loader 176c176,177 clazz = parent.loadClass(name); --- clazz = Thread.currentThread().getContextClassLoader() .loadClass(name); [ Note : Since the parent is now not used anymore, a lot of useless code should be removed. ] I'm not a Jasper guru, so I don't know if it's a good idea to do this. Remy 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. Craig
Re: tomcat-4.0 and JSP class reloading
Quoting Craig R. McClanahan [EMAIL PROTECTED]: 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
Re: tomcat-4.0 and JSP class reloading
On Thu, 31 May 2001 12:40:34 Remy Maucherat wrote: Quoting Craig R. McClanahan [EMAIL PROTECTED]: 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/
Re: tomcat-4.0 and JSP class reloading
On Wed, 30 May 2001, Tuukk4 |[:)-| p4s4n3n wrote: hey, Is anyone fixing that point? Problem is that JSP doesn't reload classes when servlet container in same context does? Can you provide a small example that illustrates this? Tuukka Craig McClanahan