【异常】java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher异常解决方法
2017-11-10 14:05
471 查看
今天在做web项目时用到JSONObject,用的是MyEclipse自动导入的struts2的lib,其中自带了json-lib-2.1-jdk15.jar。
在struts2的action中已经导入了net.sf.json.JSONObject包。发现用到JSONObject jsonObject = new JSONObject()时,MyEclipse是没有报错的,但是到了JSONObject jsonObject = new JSONObject()时就是执行不下去!
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error that prevented it from fulfilling this request.
exception
root cause
root cause
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.30 logs.
Apache Tomcat/7.0.30
其中发现java.lang.ClassNotFoundException: net.sf.ezmorph.Morpher,很明显是没有找到相应的class。原来是除了要导入json-lib-2.1-jdk15.jar包外,还要导入其它几个依赖包:commons-beanutils.jar,commons-httpclient.jar,commons-lang.jar,ezmorph.jar,morph-1.0.1.jar
点击下载依赖jar包
导入这几个依赖包之后就不再出错了!
在struts2的action中已经导入了net.sf.json.JSONObject包。发现用到JSONObject jsonObject = new JSONObject()时,MyEclipse是没有报错的,但是到了JSONObject jsonObject = new JSONObject()时就是执行不下去!
type Exception report
message
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) …………………… org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
root cause
java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher mapsns.action.Login.login(Login.java:34) …………………… org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
root cause
java.lang.ClassNotFoundException: net.sf.ezmorph.Morpher org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) …………………… org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.30 logs.
Apache Tomcat/7.0.30
其中发现java.lang.ClassNotFoundException: net.sf.ezmorph.Morpher,很明显是没有找到相应的class。原来是除了要导入json-lib-2.1-jdk15.jar包外,还要导入其它几个依赖包:commons-beanutils.jar,commons-httpclient.jar,commons-lang.jar,ezmorph.jar,morph-1.0.1.jar
点击下载依赖jar包
导入这几个依赖包之后就不再出错了!
相关文章推荐
- 【异常】java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher异常解决方法
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- java.lang.NoClassDefFoundError net.sf.ezmorph.Morpher问题解决-pom版
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- 出现java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题的解决办法
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- 使用JSON,在SERVLET或者STRUTS的ACTION中取得数据时,如果会出现异常:java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- 使用json时java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- Java中使用json时java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
- JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决