title: Mongodb IllegalAccessException
body: <p>Hi I have this configuration in sping.</p>
  
  <p>After starting webapplication the following exception pop up:</p>
  
  <p>07:04:54,336 DEBUG ctory.support.DefaultListableBeanFactory: 221 - Creating shared instance of singleton bean 'mongo'</p>
  
  <p>07:04:54,336 DEBUG ctory.support.DefaultListableBeanFactory: 450 - Creating instance of bean 'mongo'</p>
  
  <p>07:04:54,337 DEBUG ctory.support.DefaultListableBeanFactory: 523 - Eagerly caching bean 'mongo' to allow for resolving potential circular references</p>
  
  <p>07:04:54,342 DEBUG ctory.support.DefaultListableBeanFactory:1616 - Invoking afterPropertiesSet() on bean with name 'mongo'</p>
  
  <p>07:04:54,364  WARN context.support.XmlWebApplicationContext: 487 - Exception encountered during context initialization - cancelling refresh attempt
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongo': Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method org.bson.types.ObjectId.(III)V from class com.mongodb.Bytes</p>
  
  <pre><code>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
  
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
  
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
  
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
  
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
  
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
  
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)
  
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
  
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
  
  at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)
  
  at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)
  
  at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)
  
  at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)
  
  at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)
  
  at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
  at javax.servlet.GenericServlet.init(GenericServlet.java:158)
  
  at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241)
  
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041)
  
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4944)
  
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5230)
  
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
  
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
  
  at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
  
  at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Caused by: java.lang.IllegalAccessError: tried to access method org.bson.types.ObjectId.(III)V from class com.mongodb.Bytes
      at com.mongodb.Bytes.(Bytes.java:219)
      at com.mongodb.MongoOptions.reset(MongoOptions.java:75)
      at com.mongodb.MongoOptions.(MongoOptions.java:37)</p>
  
  <pre><code>at org.springframework.data.mongodb.core.MongoFactoryBean.createInstance(MongoFactoryBean.java:141)
  
  at org.springframework.data.mongodb.core.MongoFactoryBean.createInstance(MongoFactoryBean.java:45)
  
  at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134)
  
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
  
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
  ... 32 more
  </code></pre>
  
  <p>code here</p>
  
  <p>Does anyone have a clue, what is wrong?</p>