struts2-json-plugin-2.1.8.1引发的错误

最近在使用Ajax调用action获取数据时提示如下错误:

java.lang.NoClassDefFoundError: org/apache/commons/lang/xwork/StringUtils

经过几番苦战,尝试各种办法调试,最后发现不是写法的问题,而是struts2-json-plugin版本的问题;从目前的经验来看,我遇到的大部分问题都是jar包不全或者版本不匹配导致的。

这个是struts2-json-plugin-2.3.8的下载地址:

http://download.csdn.net/download/huangbye/7694131

详细错误如下:

exception

javax.servlet.ServletException: Filter execution threw an exception

root cause

java.lang.NoClassDefFoundError: org/apache/commons/lang/xwork/StringUtils
	org.apache.struts2.json.SerializationParams.<init>(SerializationParams.java:57)
	org.apache.struts2.json.JSONResult.writeToResponse(JSONResult.java:214)
	org.apache.struts2.json.JSONResult.execute(JSONResult.java:204)
	com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
	org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
	org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)
	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
时间: 2024-10-10 06:53:31

struts2-json-plugin-2.1.8.1引发的错误的相关文章

记录struts2 json plugin 对字符串数组类型的处理

当前项目中,一开发人员在action中定义了一个字符串数组类型的属性,需要以json格式返回到页面(先不论这种设计是否最优), 结果在做页面调试时发现总是无法在ajax的success方法中获取到该属性.后台action调试发现该数组已经正确赋值,get 方法也没有问题,action相关代码如下: private String[] traceList; private String unitName; ... public String queryTrace(){ unitName = "tes

Android+struts2+JSON方式的手机开发(Login)

在手机的后台服务无论是调用WebService还是Http请求,多数都是采用Android的HttpClient实现相关的调用实现.本文实现Android+Struts2+JSON方式实现为手机前台提供服务. 涉及的知识点: 1.Struts2框架的搭建(包括Struts2的jSON插件) 2.Android前台访问Web采用HttpClient方式. 3.Android采用JSON的解析. 功能:模拟远程登录流程: 手机后台服务:由于采用Struts2的JSON响应格式,响应详细会自动转变为J

Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers &quot;public&quot;

Spring注入Action使用Json错误:org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWri

org.apache.struts2.json.JSONWriter can not access a member of class org.apache.commons.dbcp...

之前在用ssh整合json时一直发现前台获取不到json的返回数据,直接运行action出现以下错误: HTTP Status 500 - org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.

struts2 json 输出日期格式不正确

struts2 输出json中 日期出现:2013-12-17T15:57:47 错误格式的数据 原因:struts2 json插件对日期的格式化有问题 解决方法:在实体类的日期的get方法上加注解:@JSON(format="yy-MM-dd HH:mm:ss") 例如: @JSON(format = "yy-MM-dd HH:mm:ss") public Date getFindtime() { return findtime; }

Struts2+json+hignchart(简单柱状图实现--适合jquery小白)

做了一个简单的基于Struts2 + Json + HighChart的小例子,费了一下午+晚上的时间,虽然简单,但对于我这种Jquery+Ajax小白的人还是很值得记录的. 哈哈哈 # 0. 关键点找到highchart的模板网站 https://www.hcharts.cn/docs/basic-tooltip # 1. 关键点,在struts.xml中配置返回类型为json <action name="queryItemsJson" class="com.best

struts2 java.lang.StackOverflowError org.apache.struts2.json.JSONWriter

1. 问题描述: 页面通过异步访问action,    action的方法通过map封装数据,struts的result的type设置为json,后台报错 六月 25, 2016 6:54:33 下午 org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [default] in context with path [/msf] threw exception [Fil

报org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException:的错误

HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.

org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException异常解决

org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:246) org.apache.struts2.json.JSONWriter.processCustom(JSONWriter.java:178) org.apache.struts2.json.JSONWriter.p

struts2+json+jquery局部刷新实现注册验证

struts2+json+jquery局部刷新实现注册验证 1.项目需要导入的jar包 在web项目的WebRoot/WEB-INF/lib目录下导入以下包 2.在src目录下建立包com.entity,里面建立java类:UserInfo.java .  MailSenderInfo.java UserInfo.java package com.entity; import java.io.Serializable; /** * 说明:用户实体类 * @author wangcunhuazi