Calling DisplayTag returns NullPointerException
We've been using DisplayTag for awhile now without any problems, but recently, we had a wonky hdd and so we had to restore some of the stuff on there. Unfortunately, DisplayTag broke and stops everything else when called:
<display:table name="pageScope.userKeyList.licenseKeyList" id="userKey" pagesize="10" defaultsort="7" defaultorder="descending" sort="list" class="bodytext" width="100%" border="1">
Will return with the following error:
java.lang.NullPointerException
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
org.displaytag.properties.TableProperties.getClassProperty(TableProperties.java:759)
org.displaytag.properties.TableProperties.getClassPropertyInstance(TableProperties.java:776)
org.displaytag.properties.TableProperties.getRequestHelperFactoryInstance(TableProperties.java:714)
org.displaytag.tags.TableTag.initParameters(TableTag.java:715)
org.displaytag.tags开发者_如何学C.TableTag.doStartTag(TableTag.java:600)
org.apache.jsp.misc.key_002dtable_jsp._jspService(key_002dtable_jsp.java:113)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
I'm not quite familiar with Apache Tomcat and Java but I suspect that it has to do with a catalina's security policy. I'm hoping that someone could either confirm this or help point me in the right direction. We're currently on Tomcat 5.
My suspicion is that it's not a DisplayTag issue, it's an issue of the underlying data you're trying to display with DisplayTag. Did you check to make sure that the object referenced by pageScope
really has a non-null userKeyList
property, and that the userKeyList
property really has a non-null licenseKeyList
property, for example?
(Just reading those names, I'm suspicious that perhaps your restoration didn't restore a license key that you are expecting...)
Judging from the stack trace, it looks like Class.forName() is being called with a null
name parameter. Check the sourcecode of TableTag and TableProperties (at / near the line numbers indicated by the stacktrace) to find out what it going on. My guess is that a required property is missing from something: either a configuration file or your JSP's use of the tag.
精彩评论