首页 > 代码库 > struts2+json的几个错误

struts2+json的几个错误

今晚碰到的几个错误,经百度+谷歌+分析,正确解决了,贴出来供其他人参考一下  ps:浪费在这些错误-解决错误的时间好多撒,java 程序媛伤不起哦....... /-|-\

准备工作:

把strus2+json整合的jar包复制到     /项目名/WebRoot/WEB-INF/lib中,如下图:



之前运行好好的,动了一下代码就冒出来这么多错误,如下所示:

1. Dispatcher initialization failed.

Unable to load configuration. - package - jar:file:/D:/Tomcatserver7.0.39/apache-tomcat-7.0.39/webapps/Bishe/WEB-INF/lib/struts2-json-1. plugin-2.3.8.jar!/struts-plugin.xml:8:59

---------------------------------------

参考博客http://blog.sina.com.cn/s/blog_6f45626b010168hl.html


Caused by: The package name ‘json-default‘ at location package - jar:file:/D:/software/jboss-4.2.2.GA/server/default/deploy/order.war/WEB-INF/lib/struts2-json-plugin-2.2.1.1.jar!/struts-plugin.xml:8:59 is already been used by another package at location package - jar:file:/D:/software/jboss-4.2.2.GA/server/default/deploy/order.war/WEB-INF/lib/jsonplugin-0.34.jar!/struts-plugin.xml:8:59 - package - jar:file:/D:/software/jboss-4.2.2.GA/server/default/deploy/order.war/WEB-INF/lib/struts2-json-plugin-2.2.1.1.jar!/struts-plugin.xml:8:59

 

引起的原因大概是war文件或部署中有重复的plugin.jar包,有重复则删除,若检查没有重复仍然有问题,删除掉已经部署的项目,重新启动Tomcat或JBoss服务器重新部署而不是Redeploy,最终解决问题。

--------------------------------------------


本来我的所有jar包是有这两个jar包的,看到上面博客所说,估计是这两个重复了,所有删除了第一个strust2-json-plugin-2.3.8.jar保留了第二个json-lib-2.3-jdk15.jar.  OK,这个错误解决了! 但第2个错误如下冒出来了:


2. org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [/Bishe] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1976401]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@cbf8b7]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

--------看着那么一大串英文,应该是内存泄露了等等。。。

想起了之前改动的代码:【在Action中用request接收前台的参数,红色框的代码必须要有啊,就是粗心忘了实现ServletRequestAware,所以导致上面的错误了



struts2+json的几个错误