ClassNotFoundException is thrown from function mapper when it is (re)mapping a given class/method name pair back to method instance. This may happen due to serialization. Patch is simply to replace used Class.forName with ReflectionUtil.forName java.lang.ClassNotFoundException: at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at org.apache.el.lang.FunctionMapperImpl$Function.getMethod(FunctionMapperImpl.java:147) at org.apache.el.lang.FunctionMapperImpl.resolveFunction(FunctionMapperImpl.java:53) at org.apache.el.parser.AstFunction.getValue(AstFunction.java:71) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
Created attachment 19687 [details] FunctionMapperImpl
NPE is thrown from function mapper when externalizing second time. First time loses reference to originating method and second time ignores the fact that method may indeed still be null. Patch is to prefer non-transient fields filled during externalization over method itself. Caused by: java.lang.NullPointerException at org.apache.el.lang.FunctionMapperImpl$Function.writeExternal(FunctionMapperImpl.java:123) at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at java.util.HashMap.writeObject(HashMap.java:1000) at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at org.apache.el.lang.FunctionMapperImpl.writeExternal(FunctionMapperImpl.java:74) at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at org.apache.el.ValueExpressionImpl.writeExternal(ValueExpressionImpl.java:256) at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at com.sun.facelets.el.TagValueExpression.writeExternal(TagValueExpression.java:128)
Comment on attachment 19687 [details] FunctionMapperImpl Index: C:/cygwin/home/kivtuo/scm/tomcat/tc6.0.x/jasper/src/share/org/apache/el/lang/Fu nctionMapperImpl.java =================================================================== --- C:/cygwin/home/kivtuo/scm/tomcat/tc6.0.x/jasper/src/share/org/apache/el/lang/Fu nctionMapperImpl.java (revision 416976) +++ C:/cygwin/home/kivtuo/scm/tomcat/tc6.0.x/jasper/src/share/org/apache/el/lang/Fu nctionMapperImpl.java (working copy) @@ -119,9 +119,9 @@ public void writeExternal(ObjectOutput out) throws IOException { out.writeUTF((this.prefix != null) ? this.prefix : ""); out.writeUTF(this.localName); - out.writeUTF(this.m.getDeclaringClass().getName()); - out.writeUTF(this.m.getName()); - out.writeObject(ReflectionUtil.toTypeNameArray(this.m.getParameterTypes())); + out.writeUTF((this.owner != null) ? this.owner : this.m.getDeclaringClass().getName()); + out.writeUTF((this.name != null) ? this.name : this.m.getName()); + out.writeObject((this.types != null) ? this.types : ReflectionUtil.toTypeNameArray(this.m.getParameterTypes())); } /* @@ -143,7 +143,7 @@ public Method getMethod() { if (this.m == null) { try { - Class t = Class.forName(this.owner); + Class t = ReflectionUtil.forName(this.owner); Class[] p = ReflectionUtil.toTypeArray(this.types); this.m = t.getMethod(this.name, p); } catch (Exception e) {
Over 6 months later!!!! this bug STILL exists in Tomcat 6.0.14. Implement the fix by Tuomas Kiviaho. It really works.
Patch attached was applied - marking as fixed - please confirm. Committed revision 578466.
The patch editing feature that I used wasn't as clear as it should have been. This issue is now only partially completed, that is the CNFE has been fixed, but NPE still remains. Comment number #3 is the result of patch edition containing both aspects.
Applied the other patch too - Thanks! Committed revision 578610.
I verified the issue but could not test against a build since there doesn't seem to be CI oriented mavenization (neither for snapshots nor real versions?). Hence I don't feel comfortable marking this closed myself without actually testing it first with a build common for all.
*** Bug 42866 has been marked as a duplicate of this bug. ***
Fixed in 6.0.15 (6.0.16). I am changing status from VERIFIED to CLOSED.