[struts2]2.3.14 json-plugin 存在bug<java.lang.NoSuchFieldException: DEFAULT_PARAM>

转载 2013年12月01日 22:56:48

项目启动时 一直报异常,不影响运行但是看着老烦人了。

添加上json plugin之后启动就会报错

java.lang.NoSuchFieldException: DEFAULT_PARAM
    at java.lang.Class.getField(Class.java:1537)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:569)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:521)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:250)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:473)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3926)
    at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:426)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
    at java.lang.Thread.run(Thread.java:722)

这个错误是因为struts2在启动的时候默认检查result的属性,

一般我们写<result>/WEB-INF/index.jsp</result>

这个是默认result的names="success" DEFAULT_PARAM为"/WEB-INF/index.jsp"的意思.

默认的stuts2的result会有DEFAULT_PARAM属性比如StrutsResultSupport这个基类

public abstract class StrutsResultSupport implements Result, StrutsStatics {

    private static final Logger LOG = LoggerFactory.getLogger(StrutsResultSupport.class);

    /** The default parameter */
    public static final String DEFAULT_PARAM = "location";

    private boolean parse;
    private boolean encode;
    private String location;
    private String lastFinalLocation;
 然而jsonresult就没有这个属性

public class JSONResult implements Result {

    private static final long serialVersionUID = 8624350183189931165L;

    private static final Logger LOG = LoggerFactory.getLogger(JSONResult.class);

    private String encoding;
    private String defaultEncoding = "ISO-8859-1";
    private List<Pattern> includeProperties;
    private List<Pattern> excludeProperties;
    private String root;
    private boolean wrapWithComments;
    private boolean prefix;
    private boolean enableSMD = false;
    private boolean enableGZIP = false;
    private boolean ignoreHierarchy = true;
    private boolean ignoreInterfaces = true;
    private boolean enumAsBean = JSONWriter.ENUM_AS_BEAN_DEFAULT;
    private boolean noCache = false;
    private boolean excludeNullProperties = false;
    private int statusCode;
    private int errorCode;
    private String callbackParameter;
    private String contentType;
    private String wrapPrefix;
    private String wrapSuffix;

一下地址 是修改好的jar包,下载后放到项目中便可以。

这是下载地址:http://download.csdn.net/detail/liweifengwf/6641041




举报

相关文章推荐

存在bug<java.lang.NoSuchFieldException: DEFAULT_PARAM>

[struts2]2.3.14 json-plugin 存在bug 添加上json plugin之后启动就会报错 java.lang.NoSuchFieldExcept...

java.lang.NoSuchFieldException: DEFAULT_PARAM

项目用的是struts 2.3.15.3 这个版本,项目中有用到 struts2-json-plugin-2.3.15.3.jar 这个jar包。当把log4j的日志级别调为error时,没出现问题。...

我是如何成为一名python大咖的?

人生苦短,都说必须python,那么我分享下我是如何从小白成为Python资深开发者的吧。2014年我大学刚毕业..

strtus2.3 java.lang.NoSuchFieldException: DEFAULT_PARAM>

strtus2.3.15.1 的bug请下载 http://download.csdn.net/detail/livalue 或加群到群共享中下载.214579879

java.lang.NoSuchFieldException: DEFAULT_PARAM doesn't have a default param [DEFAULT_PARAM] defined!

struts2的bug通过升级版本来解决

bug之java.lang.NoSuchFieldException: DEFAULT_PARAM

问题描述: java.lang.NoSuchFieldException: DEFAULT_PARAM  at java.lang.Class.getField(Unknown Source) ...

Struts2 的错误----couldn't clear tomcat cache java.lang.NoSuchFieldException: resourceEntries

25-Dec-2014 11:29:01.466 WARNING [http-nio-8080-exec-8] com.opensymphony.xwork2.util.LocalizedTextUt...

struts2拦截器报错 Struts2 的错误----couldn't clear tomcat cache java.lang.NoSuchFieldException: resourceEnt

1.请求发送后无法找到package的位置或者action的方法,都会报此错误,这是应该检查一下请求的地址和struts2.xml中的配置是否一致 2.配置struts2的拦...
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)