Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 638
azec-pdx Avatar asked Aug 12 '14 10:08

azec-pdx


1 Answers

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.

like image 119
Oliver Drotbohm Avatar answered Nov 12 '22 16:11

Oliver Drotbohm