MOngo DB 3.2.2 java driver and error

530 views
Skip to first unread message

Pradeep Singh

unread,
Oct 10, 2016, 6:59:05 PM10/10/16
to mongodb-user
I upgraded my apps to use Mongo java driver 3.2.2 and seeing below exceptions.


om.comcast.sparrow.activatorweb.repository.MongoDBConfiguration.mongoTemplate - Error occurred when creating the mongoTemplate.......ERROR_MESSAGE: Error creating bean with name 'mongoDbFactory' defined in class path resource [com/comcast/sparrow/activatorweb/repository/MongoDBConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.MongoDbFactory]: Factory method 'mongoDbFactory' threw exception; nested exception is java.lang.IllegalAccessError: tried to access method org.bson.types.ObjectId.<init>(III)V from class com.mongodb.Bytes ERROR_DETAILS: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDbFactory' defined in class path resource [com/comcast/sparrow/activatorweb/repository/MongoDBConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.MongoDbFactory]: Factory method 'mongoDbFactory' threw exception; nested exception is java.lang.IllegalAccessError: tried to access method org.bson.types.ObjectId.<init>(III)V from class com.mongodb.Bytes at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1128) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1023) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381) at com.comcast.sparrow.activatorweb.repository.MongoDBConfiguration$$EnhancerBySpringCGLIB$$bd6b329d.mongoDbFactory(<generated>) at com.comcast.sparrow.activatorweb.repository.MongoDBConfiguration.mongoTemplate(MongoDBConfiguration.java:68) at com.comcast.sparrow.activatorweb.repository.MongoDBConfiguration$$EnhancerBySpringCGLIB$$bd6b329d.CGLIB$mongoTemplate$0(<generated>) at com.comcast.sparrow.activatorweb.repository.MongoDBConfiguration$$EnhancerBySpringCGLIB$$bd6b329d$$FastClassBySpringCGLIB$$ecc75b5b.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) at 


Wan Bachtiar

unread,
Nov 1, 2016, 3:22:26 AM11/1/16
to mongodb-user

Factory method ‘mongoDbFactory’ threw exception; nested exception is java.lang.IllegalAccessError: tried to access method org.bson.types.ObjectId.(III)V from class com.mongodb.Bytes at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)

Hi Pradeep,

It’s been a while since you posted the question, have you found a solution to it yet ?

Based on your exception log output, looks like there is a compatibility issue between com.mongodb.Bytes and org.springframework.beans.factory for mongoDbFactory.

I would suggest to post a question on Spring at StackOverflow to reach wider audience regarding the java spring compatibility version .

Kind regards,

Wan

Reply all
Reply to author
Forward
0 new messages