History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: OGNL-13
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jesse Kuhnert
Reporter: Tim Downey
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OGNL

Class loading issue with in OGNL 2.6.7+ when multiple classloaders

Created: 13/Mar/07 07:19 AM   Updated: 05/May/07 03:24 PM
Component/s: Core Runtime
Affects Version/s: 2.6.11, 2.6.9
Fix Version/s: 2.7

Environment: Java 1.6, Windows, JBoss


 Description  « Hide
Hi,

With some help from Jesse, I've tracked down a classloading issue with OGNL 2.6.7+. When evaluating expressions in an environment with multiple classloaders, NullPointerExceptions can occur if OGNL is configured to use the incorrect classloader when evaluating expressions.

In my environment, I have a WAR classloader and the unified classloader from JBoss. If I attempt to evaluate an expression against an object loaded by the unified classloader that attempts to refer to a class managed by the WAR classloader, I get a NullPointerException.

It would be nice if OGNL would throw a ClassNotFoundException when Ognl.getValue() fails to load a class rather than a NPE. Below is the trace that occurs when the expression attempts to load a class that can't be found in
the attempted classloader.

FWIW, following Jesse's directions I was able to use a custom resolver ala Tapestry to solve my issue. Here's a reference to that.

http://svn.apache.org/viewvc/tapestry/tapestry4/tags/4.0.2/framework/src/java/org/apache/tapestry/services/impl/ExpressionEvaluatorImpl.java?view=markup


[java] 14:23:01,480 ERROR [STDERR] java.lang.NullPointerException
[java] 14:23:01,480 ERROR [STDERR] at ognl.OgnlRuntime$ClassCache.get(OgnlRuntime.java:144)
[java] 14:23:01,480 ERROR [STDERR] at ognl.OgnlRuntime.getHandler(OgnlRuntime.java:1551)
[java] 14:23:01,480 ERROR [STDERR] at ognl.OgnlRuntime.getMethodAccessor(OgnlRuntime.java:1494)
[java] 14:23:01,480 ERROR [STDERR] at ognl.OgnlRuntime.callStaticMethod(OgnlRuntime.java:804)
[java] 14:23:01,480 ERROR [STDERR] at ognl.ASTStaticMethod.getValueBody(ASTStaticMethod.java:67)
[java] 14:23:01,480 ERROR [STDERR] at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
[java] 14:23:01,480 ERROR [STDERR] at ognl.SimpleNode.getValue(SimpleNode.java:210)
[java] 14:23:01,527 ERROR [STDERR] at ognl.ASTChain.getValueBody(ASTChain.java:109)
[java] 14:23:01,527 ERROR [STDERR] at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
[java] 14:23:01,527 ERROR [STDERR] at ognl.SimpleNode.getValue(SimpleNode.java:210)
[java] 14:23:01,527 ERROR [STDERR] at ognl.Ognl.getValue(Ognl.java:333)
[java] 14:23:01,527 ERROR [STDERR] at ognl.Ognl.getValue(Ognl.java:413)
[java] 14:23:01,527 ERROR [STDERR] at ognl.Ognl.getValue(Ognl.java:454)
[java] 14:23:01,527 ERROR [STDERR] at ognl.Ognl.getValue(Ognl.java:433)
[java] 14:23:01,527 ERROR [STDERR] at com.workscape.oneforce.web.component.employeedetails.EmployeeDetails.getValue(E mployeeDetails.java:96)
[java] 14:23:01,527 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor967.invoke(Unknown Source)
[java] 14:23:01,527 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)
[java] 14:23:01,527 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
[java] 14:23:01,527 ERROR [STDERR] at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:491)
[java] 14:23:01,527 ERROR [STDERR] at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:904)
[java] 14:23:01,527 ERROR [STDERR] at ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:54)
[java] 14:23:01,527 ERROR [STDERR] at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)
[java] 14:23:01,527 ERROR [STDERR] at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1616)
[java] 14:23:01,527 ERROR [STDERR] at ognl.ASTProperty.getValueBody(ASTProperty.java:96)
[java] 14:23:01,527 ERROR [STDERR] at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
[java] 14:23:01,527 ERROR [STDERR] at ognl.SimpleNode.getValue(SimpleNode.java:210)
[java] 14:23:01,527 ERROR [STDERR] at ognl.Ognl.getValue(Ognl.java:333)
[java] 14:23:01,527 ERROR [STDERR] at ognl.Ognl.getValue(Ognl.java:310)
[java] 14:23:01,527 ERROR [STDERR] at org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.readCompiled(Expressi onEvaluatorImpl.java:91)
[java] 14:23:01,527 ERROR [STDERR] at $ExpressionEvaluator_111298ac296.readCompiled($ExpressionEvaluator_111298ac296. java)
[java] 14:23:01,527 ERROR [STDERR] at org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBindi ng.java:110)
[java] 14:23:01,527 ERROR [STDERR] at org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java: 103)
[java] 14:23:01,527 ERROR [STDERR] at org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:87)
[java] 14:23:01,527 ERROR [STDERR] at $Insert_1715.getValue($Insert_1715.java)


 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.