码迷,mamicode.com
首页 > 其他好文 > 详细

struts2 <debug>标签报错:Caught an exception while getting the property values of null

时间:2014-08-26 17:25:36      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   os   java   io   for   

java.lang.NullPointerException

at com.opensymphony.xwork2.ognl.OgnlUtil.getBeanInfo(OgnlUtil.java:398)
at com.opensymphony.xwork2.ognl.OgnlUtil.getPropertyDescriptors(OgnlUtil.java:344)
at com.opensymphony.xwork2.ognl.OgnlUtil.getBeanMap(OgnlUtil.java:375)
at com.opensymphony.xwork2.ognl.OgnlReflectionProvider.getBeanMap(OgnlReflectionProvider.java:97)
at org.apache.struts2.components.Debug.start(Debug.java:71)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:53)
at org.apache.jsp.WEB_002dINF.jsp.member2Restaurant.searchPartner_jsp._jspx_meth_s_005fdebug_005f0(searchPartner_jsp.java:272)
at org.apache.jsp.WEB_002dINF.jsp.member2Restaurant.searchPartner_jsp._jspService(searchPartner_jsp.java:183)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:278)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:236)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at cn.com.eatlab.web.AuthInterceptor.intercept(AuthInterceptor.java:74)
...........
ERROR ExceptionMappingInterceptor:38 - Caught an exception while getting the property values of null - Class: com.opensymphony.xwork2.ognl.OgnlUtil
File: OgnlUtil.java
Method: getBeanInfo
Line: 398 - com/opensymphony/xwork2/ognl/OgnlUtil.java:398:-1
org.apache.jasper.JasperException: Caught an exception while getting the property values of null - Class: com.opensymphony.xwork2.ognl.OgnlUtil
File: OgnlUtil.java
Method: getBeanInfo
Line: 398 - com/opensymphony/xwork2/ognl/OgnlUtil.java:398:-1
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)


debug进去到Debug.class文件发现这样一段代码:

 public boolean start(Writer writer) {
        boolean result = super.start(writer);


        ValueStack stack = getStack();
        Iterator iter = stack.getRoot().iterator();
        List stackValues = new ArrayList(stack.getRoot().size());
        while (iter.hasNext()) {
            Object o = iter.next();
            Map values;
            try {
                values = reflectionProvider.getBeanMap(o);
            } catch (Exception e) {
                throw new StrutsException("<span style="color:#ff0000;">Caught an exception while getting the property values of</span> " + o, e);
            }
            stackValues.add(new DebugMapEntry(o.getClass().getName(), values));
        }

        addParameter("stackValues", stackValues);

        return result;
  }

图片bubuko.com,布布扣




发现root中一个对象为null,此为发出异常的的原因,


接着发现jsp页面有一个<s:debug></s:debug>标签,去掉此标签后就正常了。


但是又产生了一个新的问题,debug标签就是debug用的,却因为debug标签产生bug......


搞清楚为什么就要知道为什么 valueStack.getRoot() 中会有一个 为null的 对象,


也就是要搞清楚valueStack到底是放的什么东西...然后...求高手分析...








struts2 <debug>标签报错:Caught an exception while getting the property values of null

标签:des   style   blog   http   color   os   java   io   for   

原文地址:http://blog.csdn.net/wufengui1315/article/details/38849707

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!