Bug 33358 - jasper2 bug because classloader-problems
jasper2 bug because classloader-problems
Status: RESOLVED DUPLICATE of bug 33373
Product: Tomcat 5
Classification: Unclassified
Component: Jasper
5.0.30
Other Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-02-02 15:44 UTC by Marco Machmer
Modified: 2005-02-10 06:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Machmer 2005-02-02 15:44:32 UTC
hi there, 
 
i think the patch of bugreport 
http://issues.apache.org/bugzilla/show_bug.cgi?id=32330 is not correct. 
jspc get an error if i compile jsp's with struts-el tags like 
<html-el:option>. 
following stacktrace is coming: 
  [jasper2] SCHWERWIEGEND: MessageResourcesFactory.createFactory 
  [jasper2] java.lang.ClassNotFoundException: 
org.apache.struts.util.PropertyMessageResourcesFactory 
  [jasper2]     at java.net.URLClassLoader$1.run(URLClassLoader.java:199) 
  [jasper2]     at java.security.AccessController.doPrivileged(Native Method) 
  [jasper2]     at java.net.URLClassLoader.findClass(URLClassLoader.java:187) 
  [jasper2]     at java.lang.ClassLoader.loadClass(ClassLoader.java:289) 
  [jasper2]     at java.lang.ClassLoader.loadClass(ClassLoader.java:235) 
  [jasper2]     at 
org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:117) 
  [jasper2]     at 
org.apache.struts.util.MessageResourcesFactory.createFactory(MessageResourcesFactory.java:148) 
  [jasper2]     at 
org.apache.struts.util.MessageResources.getMessageResources(MessageResources.java:493) 
  [jasper2]     at 
org.apache.struts.taglib.html.BaseHandlerTag.<clinit>(BaseHandlerTag.java:64) 
  [jasper2]     at java.lang.Class.forName0(Native Method) 
  [jasper2]     at java.lang.Class.forName(Class.java:141) 
  [jasper2]     at 
org.apache.strutsel.taglib.html.ELLinkTagBeanInfo.class$(ELLinkTagBeanInfo.java:46) 
  [jasper2]     at 
org.apache.strutsel.taglib.html.ELLinkTagBeanInfo.getPropertyDescriptors(ELLinkTagBeanInfo.java:46) 
  [jasper2]     at 
java.beans.Introspector.getTargetPropertyInfo(Introspector.java:459) 
  [jasper2]     at java.beans.Introspector.getBeanInfo(Introspector.java:372) 
  [jasper2]     at java.beans.Introspector.getBeanInfo(Introspector.java:144) 
  [jasper2]     at 
org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3684) 
  [jasper2]     at 
org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2102) 
  [jasper2]     at 
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1583) 
  [jasper2]     at 
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441) 
  [jasper2]     at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) 
  [jasper2]     at 
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) 
  [jasper2]     at 
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1689) 
  [jasper2]     at 
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441) 
  [jasper2]     at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) 
  [jasper2]     at 
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) 
  [jasper2]     at 
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219) 
  [jasper2]     at org.apache.jasper.compiler.Node$Root.accept(Node.java:456) 
  [jasper2]     at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) 
  [jasper2]     at 
org.apache.jasper.compiler.Generator.generate(Generator.java:3272) 
  [jasper2]     at 
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244) 
  [jasper2]     at 
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470) 
  [jasper2]     at org.apache.jasper.JspC.processFile(JspC.java:805) 
  [jasper2]     at org.apache.jasper.JspC.execute(JspC.java:938) 
... 
in the source code of Jspc.java the finaly-block in the processFile method for 
resetting the classloader is wrong there. because 
it resets the classloader after the first file was processed. and any other 
jsp's, that uses 
the struts-el-tags (for example <html-el:option...) can not be compiled. i 
think the finaly-block belongs 
to the end of the execute-method with following change: 
        } finally { 
            if(originalClassLoader != null) { 
                Thread.currentThread().setContextClassLoader(originalClassLoader); 
                loader = null; // set to null!! 
            } 
        } 
where originalClassLoader is declared as instance variable as: 
private ClassLoader originalClassLoader = null; 
 
what's your opinion? 
 
marco
Comment 1 Remy Maucherat 2005-02-10 15:10:09 UTC
The bug is actually a duplicate of bug 33373.

*** This bug has been marked as a duplicate of 33373 ***