导致该问题的原因顾明思议就是该类没有找到,表面上看是没有导入相应的jar包,但往往遇到的问题是包的冲突问题,和包的依赖不全问题
1、包的版本问题
<dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> </dependency>
需要制定jdk的版本,jdk15表示jdk1.5,同时要查看本地是否导入别的版本json-lib,有的话移除掉
2、包的依赖没有导入全,以下的包要一起导入
3、Jackson可以轻松的将Java对象转换成json对象和xml文档,同样也可以将json、xml转换成Java对象,依赖如下:<dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.8.3</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency>
<dependency> <groupId>net.sf.ezmorph</groupId> <artifactId>ezmorph</artifactId> <version>1.0.6</version> </dependency>
<dependency> groupId>net.sf.json-lib</artifactId>json-lib-ext-springversion>1.0.2>>
<dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.13</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.13</version> </dependency>原文链接:https://www.f2er.com/json/289709.html