You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Najeed Ahmed Khan <na...@interwoven.com> on 2009/02/13 08:01:52 UTC
javax.el.ELContext.getFunctionMapper().resolveFunction() returns null always
Hi,
I'm developing an application to parse EL scripts in a file and evaluate
them. I am using Java Unified EL for the same. The value expressions are
resolving fine however the functions are not. I'm using Tomcat 6.0.10
which is bundled with JBoss 4.2.3.
The way I am evaluating the expression is:
final MethodExpression methodExpr =
exprFactory.createMethodExpression(jspContext.getELContext(), el,
expectedType, paramTypes);
Object result = methodExpr.invoke(jspContext.getELContext(), params);
However, the function is not being invoked and I get a stack trace like
such:
2009-02-12 22:35:13,629 [http-0.0.0.0-8080-5] ERROR STDERR () -
javax.el.ELException: Function 'testtld:escapeJava' not found
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:171)
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.parser.SimpleNode.accept(SimpleNode.java:129)
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:133)
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:147)
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBu
ilder.java:197)
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
org.apache.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFac
toryImpl.java:57)
2009-02-12 22:35:13,630 [http-0.0.0.0-8080-5] ERROR STDERR () - at
test.util.ELExpressionEvaluator.evaluate(ELExpressionEvaluator.java:120)
The jsp page that I am using to obtain the ELContext has the taglib
directive to include that particular tld. If I invoke that JSP function
from a JSP page(using EL), it works fine. However, when I try to resolve
the function programmatically as above, I get the error.
When I checked the Tomcat source code, I noticed in
org.apache.jasper.el.ELContextImpl :
private final static FunctionMapper NullFunctionMapper = new
FunctionMapper() {
public Method resolveFunction(String prefix, String localName) {
return null;
}
};
And a few lines below that,
private FunctionMapper functionMapper = NullFunctionMapper; // immutable
Although there is a
public void setFunctionMapper(FunctionMapper functionMapper) {
this.functionMapper = functionMapper;
}
I am not sure whether that is invoked or how to have it invoked.
This could be the problem for me as the
ELContext.getFunctionMapper().resolveFunction(...) would return null and
I receive a message which corresponds to the Method object resolving to
null.
I searched over the internet and did not come up with anything
related/conclusive that could point me towards a configuration or
programmatic step that I could've missed.
I'd appreciate it if you could give me some pointers as to what might be
the problem here and how to fix it. Also, I do not understand why the
org.apache.jasper.el package is being used instead of the org.apache.el
package which is the newer implementation.
Thanks,
Najeed.