当前位置: 代码迷 >> Web前端 >> xwork2和xwork1共用的有关问题
  详细解决方案

xwork2和xwork1共用的有关问题

热度:129   发布时间:2012-10-29 10:03:53.0
xwork2和xwork1共用的问题
在提交类似userinfo.userCompany.name时报的错

14:57:56,375 ERROR InstantiatingNullHandler:110 - Could not create and/or set value back on to object
java.lang.NullPointerException
at com.opensymphony.xwork2.util.InstantiatingNullHandler.createObject(InstantiatingNullHandler.java:123)
at com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(InstantiatingNullHandler.java:104)
at ognl.ASTProperty.getValueBody(ASTProperty.java:94)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTChain.setValueBody(ASTChain.java:168)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork.util.OgnlUtil.setValue(OgnlUtil.java:188)
at com.opensymphony.xwork.util.OgnlValueStack.setValue(OgnlValueStack.java:162)
at com.opensymphony.xwork.util.OgnlValueStack.setValue(OgnlValueStack.java:145)
at com.opensymphony.xwork.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:144)
at com.opensymphony.xwork.interceptor.ParametersInterceptor.before(ParametersInterceptor.java:119)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:30)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
at com.opensymphony.webwork.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:174)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
at com.opensymphony.xwork.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:151)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:31)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:273)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:202)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:220)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:220)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:623)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444)
at java.lang.Thread.run(Unknown Source)

在只有xwork1时,界面不会报错,后来加入了xwork2则不会报错,
产生该bug的原因是因为解析的时候走了xwork2
取巧的解决方案是在classpath中优先设置xwork1