Missing class org.springframework.objenesis.ObjenesisStd

守給你的承諾、 提交于 2019-11-27 07:44:33

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/25262248/missing-class-org-springframework-objenesis-objenesisstd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!