问题描述
这是STRUTS的配置:<action name="addLine" class="action.MetroLineAction" method="addLine"><result name="success" type="redirect">getLines?cityArea=${cityArea}</result></action>ACTION中参数cityArea也有get、set:public String getCityArea() {return cityArea;}public void setCityArea(String cityArea) {this.cityArea = cityArea;}这是外部包的引用:报错信息如下:message description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: Filter execution threw an exception root cause java.lang.NoClassDefFoundErrorcom.opensymphony.xwork.util.OgnlValueStack$ObjectAccessor.getProperty(OgnlValueStack.java:55)ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2210)com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:125)ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2210)ognl.ASTProperty.getValueBody(ASTProperty.java:114)ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)ognl.SimpleNode.getValue(SimpleNode.java:258)ognl.Ognl.getValue(Ognl.java:494)com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:206)com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(OgnlValueStack.java:276)com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(OgnlValueStack.java:303)com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:185)com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:118)com.opensymphony.xwork2.util.TextParseUtil.translateVariables(TextParseUtil.java:62)org.apache.struts2.dispatcher.StrutsResultSupport.conditionalParse(StrutsResultSupport.java:198)org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:185)com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)大家帮忙看下是哪的问题,多谢了。 问题补充:业务大概是这样的,添加页面跳到添加的action里,添加成功后直接传一个参数转到另一个action,当配置文件读这个参数的时候报的错。
解决方案
引用root cause java.lang.NoClassDefFoundError 汗。。。你哪个class没找到没贴出来吧。。。。一般NoClassDefFoundError 后面会提示哪个类的吧个人觉得要不就是缺包 要不就是包多了
解决方案二:
你把你的struts2中对应过滤器的配置信息帖出来吧
解决方案三:
报过滤器执行出错和java.lang.NoClassDefFoundError错误,NoClassDefFoundError表示在类加载时候未找到定义--该类不存在。综合下,可能是你过滤器配置路径或者未导入对应过滤器的包。看看你的配置文件中过滤器的配置
解决方案四:
看错误提示估计是jar包的问题,找找看是否有这个包,或者有包冲突,删掉多余的就可以了!
解决方案五:
如果是前台传入后台的时候发的错误,那么就看看你的属性设置,你可以把这个city属性删了,再看看是否还报错,
解决方案六:
有说是classpath里没有设置 “.” 导致的…试一下
解决方案七:
是不是设置了devMode =true了. 改成false 试试看.
解决方案八:
你的包有点多。
解决方案九:
囧 那你把<result name="success" type="redirect">改成forward试试 不要用redirect