[标题]:调试EL函数时,Tomcat提示NullPointerException
[时间]:2009-4-2
[摘要]:EL函数对应的Java方法必须是静态的。
[关键字]:NullPointerException,EL函数,taglib,function,JSP
[平台]:Tomcat6
[作者]:Winty (wintys@gmail.com)
[正文]:
调试EL函数时,Tomcat提示如下错误:
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.el.parser.AstFunction.getValue(AstFunction.java:94)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:928)
at org.apache.jsp.ch11_005fEL.ELFunction.ELFunctionTest_jsp._jspService(ELFunctionTest_jsp.java:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:866)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:716)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1498)
at java.lang.Thread.run(Thread.java:619)
在网上查到了类似java.lang.reflect.Method.invoke的错误信息,与自己的并不一致。最后,发现书上讲到的一句话,EL函数对应的Java方法必须是静态的。错误原因就是这样。把所涉及的方法改为静态就可以正常执行EL函数了。
posted on 2009-04-03 19:02
天堂露珠 阅读(382)
评论(0) 编辑 收藏 所属分类:
Error