严重: Exception starting filter struts2 解决办法

这些天在进行java web开发的过程中,启动tomcat总是报错,具体错误如下:

 

严重: Exception starting filter struts2
Unable to load configuration. - [unknown location]
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1429)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 

上网查了很久都没找到解决办法,最后只好将工程中WEB-INF/lib目录下的jar包一个个删除来排查,终于发现了是jar包冲突。原来引入json-lib-2.4-jdk15.jar,为了使用JSONArray.fromObject()功能再引入了struts2-json-plugin-2.2.3.jar,正是struts2-json-plugin-2.2.3.jar导致的异常抛出,据此再经上网找资料,使用了jsonplugin-0.32.jar替代完美解决问题(struts2.0.xx版本),如果是struts2.1.xx以上版本则需对应使用jsonplugin-0.33.jar或更高版本。如果使用jsonplugin-0.xx.jar替换后还不行,则就需要仔细检查一下其它jar包的版本是否匹配的问题!

 

posted @ 2016-02-02 14:59  指尖飞舞  阅读(25166)  评论(2编辑  收藏