已解决 java.lang.NoClassDefFoundError: org/springframework/util/ClassUtils

java.lang.NoClassDefFoundError: org/springframework/util/ClassUtils
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:101)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: org.springframework.util.ClassUtils
	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 18 more

pom文件如下


  4.0.0
  com
  o2o
  0.0.1-SNAPSHOT
  war
  
		4.3.7.RELEASE
	
  
		
		
			junit
			junit
			4.12
		

		
		
		
			ch.qos.logback
			logback-classic
			1.2.1
		

		
		
			mysql
			mysql-connector-java
			5.1.37
			runtime
		
		
			c3p0
			c3p0
			0.9.1.2
		

		
		
			org.mybatis
			mybatis
			3.4.2
		
		
			org.mybatis
			mybatis-spring
			1.3.1
		

		
		
			taglibs
			standard
			1.1.2
		
		
			jstl
			jstl
			1.2
		
		
			com.fasterxml.jackson.core
			jackson-databind
			2.8.7
		
		
			javax.servlet
			javax.servlet-api
			3.1.0
		

		
		
		
			org.springframework
			spring-core
			${spring.version}
		
		
			org.springframework
			spring-beans
			${spring.version}
		
		
			org.springframework
			spring-context
			${spring.version}
		
		
		
			org.springframework
			spring-jdbc
			${spring.version}
		
		
			org.springframework
			spring-tx
			${spring.version}
		
		
		
			org.springframework
			spring-web
			${spring.version}
		
		
			org.springframework
			spring-webmvc
			${spring.version}
		
		
		
			org.springframework
			spring-test
			${spring.version}
		

		
		
			redis.clients
			jedis
			2.9.0
		
		
			com.dyuproject.protostuff
			protostuff-core
			1.0.12
		
		
			com.dyuproject.protostuff
			protostuff-runtime
			1.0.12
		

		
		
			commons-collections
			commons-collections
			3.2
		
		
		
			net.coobird
			thumbnailator
			0.4.8
		
		
		
			com.github.penggle
			kaptcha
			2.3.2
		
		
		
			commons-fileupload
			commons-fileupload
			1.3.2
		
		
		
		
			net.sf.json-lib
			json-lib
			2.4
			jdk15
		
		
		
			com.thoughtworks.xstream
			xstream
			1.4.9
		
		
		
			org.dom4j
			dom4j
			2.0.0
		
		
		
		
			com.google.zxing
			javase
			3.3.0
		


	
	  
		  	
		  		
		  			org.apache.maven
				    maven-compiler-plugin-
				    3.6.0
				    
				    	1.8
				    	1.8
				    	UTF8
				    
		  		
		  	
	  

查看了网上很多答案,有

已解决 java.lang.NoClassDefFoundError: org/springframework/util/ClassUtils_第1张图片

还有些jar包冲突问题,都没有办法解决?

后来把spring的依赖提升了一个版本  

4.3.8.RELEASE

就解决了。  可能小版本的升级,他们也改善了一些兼容问题。

你可能感兴趣的:(随手记)