Websphere 8.5.5.5的WEB-INF / lib中的2个jar具有相同的目录结构org.json . * .
json.jar用JDK 1.6编译
使用JDK 1.7编译的commonlib.jar
Iam在一个环境中的JVM启动期间接收到以下异常,而另一个环境具有相同的jar和相同的类路径但是它正常工作 . WAS正在运行Java 1.6,因为它获得了UnsupportedClassVersionError
6/23/16 15:59:32:091 CDT] 0000005e InjectionProc W CWNEN0047W: Resource annotations on the fields of the jmaki.xhp.XmlHttpProxyServlet class will be ignored. The annotations could not be obtained because of the exception : java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/json/JSONObject, offset=6
当我专门将第二个jar添加到第二个环境的类路径时,它会产生上述错误,否则它会正常工作是否由于classpath顺序?
class load: org.json.JSONException from: file:/hosting/configs/WebSphereD24/AppServer/installedApps/nodea/sear/swar/WEB-INF/lib/json.jar
class load: org.json.JSONObject$Null from: file:/hosting/configs/WebSphereD24/AppServer/installedApps/nodea/sear/swar/WEB-INF/lib/json.jar
WebSphere如何决定从中加载class = org / json / JSONException的jar . 这个类存在于两个 jar 里......它是如何从一个json.jar加载到另一个的common.jar中的 .
1 回答
WEB-INF / lib JAR的顺序未指定,因此顺序通常由文件系统定义 . 您应该删除重复的类,而不是尝试依赖任何特定的顺序 .