Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
974 views
in Technique[技术] by (71.8m points)

spring - Missing class org.springframework.objenesis.ObjenesisStd

I am trying to use Spring Data for MongoDB. I am using full text search feature of MongoDB, and wanted to try Spring Data annotations for text index fields (@TextIndexed). This feature is available in 1.6.0.BUILD-SNAPSHOT of Spring Data MongoDB.

I am trying to setup simple application context in Spring and to run simple JUnit test. However my application context loading fails since I changed 1.5.1.RELEASE to 1.6.0.BUILD-SNAPSHOT.

The error which I am getting is below:

Caused by: org.springframework.beans.BeanInstantiationException: Could
  not instantiate bean class
  [org.springframework.data.mongodb.core.MongoTemplate]: Constructor
  threw exception; nested exception is java.lang.NoClassDefFoundError:
  org/springframework/objenesis/ObjenesisStd at
  org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) at
  org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121) at
  org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
    ... 51 more Caused by: java.lang.NoClassDefFoundError:
  org/springframework/objenesis/ObjenesisStd at
  org.springframework.data.mongodb.core.convert.DefaultDbRefResolver.<init>(DefaultDbRefResolver.java:72) at
  org.springframework.data.mongodb.core.MongoTemplate.getDefaultMongoConverter(MongoTemplate.java:1961) at
  org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:210) at
  org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:174) at 
  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
  sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at
  sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at 
  java.lang.reflect.Constructor.newInstance(Constructor.java:513) at
  org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
    ... 53 more Caused by: java.lang.ClassNotFoundException:
  org.springframework.objenesis.ObjenesisStd at
  java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
  java.security.AccessController.doPrivileged(Native Method) at
  java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
  java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
  sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
  java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Now, I tried to figure out which JAR contains org.springframework.objenesis.ObjenesisStd by using grepcode.com, but it can't return any Spring related JARs.

What am I missing here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Spring Data MongoDB 1.6 will require Spring Framework 4 as indicated on the release train's wiki page. Spring Framework 4 contains the class the exception is complaining about.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...