title: java.lang.IllegalAccessError When trying to make POJO from MongoDB?
body: <p>So I am trying use MongoJack together with MongoDB and jackson to access Data from MongoDB and turn it into POJO's. I seem to be struggling even though I am doing it in the simplest possible manner and have basically just copy pasted the mongojack tutorial at this point (<a href="http://mongojack.org" rel="nofollow">http://mongojack.org</a> ) </p>
  
  <p>The code where I am trying to get the object:</p>
  
  <pre><code>    public static void main(String[] args) {
  
      MongoClient mongoClient = new MongoClient(Arrays.asList(new ServerAddress("localhost", 27017)));
      DB db1 = mongoClient.getDB("test1");
      DBCollection coll = db1.getCollection("things1");
      JacksonDBCollection&lt;BlogPost, String&gt; Jcoll =
              JacksonDBCollection.wrap(coll,
                      BlogPost.class,
                      String.class);
  
  
      BlogPost blogPost = new BlogPost();
      WriteResult&lt;BlogPost, String&gt; result = Jcoll.insert(blogPost);
  
  
      String savedId = result.getSavedId();
  
      System.out.println(savedId);
  
  
      BlogPost test3 = Jcoll.findOneById(savedId);
  
  
  }
  </code></pre>
  
  <p>and the code for the blogpost class</p>
  
  <pre><code>public class BlogPost {
  
      @ObjectId
      private String _id;
  
      @ObjectId
      public String get_id() {
          return _id;
      }
      @ObjectId
      public void set_id(String _id) {
          this._id = _id;
      }
  }
  </code></pre>
  
  <p>the error I am getting is:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.IllegalAccessError: tried to
    access method org.bson.types.ObjectId.(III)V from class
    org.mongojack.internal.stream.ObjectIdConvertor.</p>
  </blockquote>
  
  <p>Have tried tons of different variations now and adding to the database etc works fine, just not creating an object from MongoDB. </p>
  
  <p>Edit:</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.bson.types.ObjectId.&lt;init&gt;(III)V from class org.mongojack.internal.stream.ObjectIdConvertor
  at org.mongojack.internal.stream.ObjectIdConvertor.convert(ObjectIdConvertor.java:30)
  at org.mongojack.internal.stream.DBDecoderBsonParser.getEmbeddedObject(DBDecoderBsonParser.java:70)
  at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:36)
  at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
  at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:525)
  at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:99)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:242)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
  at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:2965)
  at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1626)
  at org.mongojack.internal.stream.JacksonDBDecoder.decode(JacksonDBDecoder.java:77)
  at org.mongojack.internal.stream.JacksonDBDecoder.decode(JacksonDBDecoder.java:64)
  at com.mongodb.DBDecoderAdapter.decode(DBDecoderAdapter.java:49)
  at com.mongodb.DBDecoderAdapter.decode(DBDecoderAdapter.java:29)
  at com.mongodb.connection.ReplyMessage.&lt;init&gt;(ReplyMessage.java:57)
  at com.mongodb.connection.QueryProtocol.receiveMessage(QueryProtocol.java:290)
  at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:229)
  at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:38)
  at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155)
  at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219)
  at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:166)
  at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397)
  at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394)
  at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:195)
  at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:168)
  at com.mongodb.operation.FindOperation.execute(FindOperation.java:394)
  at com.mongodb.operation.FindOperation.execute(FindOperation.java:57)
  at com.mongodb.Mongo.execute(Mongo.java:738)
  at com.mongodb.Mongo$2.execute(Mongo.java:725)
  at com.mongodb.DBCursor.initializeCursor(DBCursor.java:815)
  at com.mongodb.DBCursor.hasNext(DBCursor.java:149)
  at org.mongojack.DBCursor.hasNext(DBCursor.java:348)
  at org.mongojack.JacksonDBCollection.findOne(JacksonDBCollection.java:1364)
  at org.mongojack.JacksonDBCollection.findOne(JacksonDBCollection.java:1334)
  at org.mongojack.JacksonDBCollection.findOneById(JacksonDBCollection.java:1282)
  at org.mongojack.JacksonDBCollection.findOneById(JacksonDBCollection.java:1269)
  at com.tapdaq.restapi.MongoConfiguration.main(MongoConfiguration.java:37)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
  </code></pre>
  
  <p>Process finished with exit code 1</p>
  
  <p>pom:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p>http://maven.apache.org/xsd/maven-4.0.0.xsd">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;com.tapdaq.restapi&lt;/groupId&gt;
  &lt;artifactId&gt;restapi&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;properties&gt;
      &lt;dropwizard.version&gt;0.8.1&lt;/dropwizard.version&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;&lt;plugins&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.4&lt;/version&gt;
          &lt;configuration&gt;
              &lt;archive&gt;
                  &lt;manifest&gt;
                      &lt;addDefaultImplementationEntries&gt;true&lt;/addDefaultImplementationEntries&gt;
                  &lt;/manifest&gt;
              &lt;/archive&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.3&lt;/version&gt;
          &lt;configuration&gt;
              &lt;createDependencyReducedPom&gt;true&lt;/createDependencyReducedPom&gt;
              &lt;filters&gt;
                  &lt;filter&gt;
                      &lt;artifact&gt;*:*&lt;/artifact&gt;
                      &lt;excludes&gt;
                          &lt;exclude&gt;META-INF/*.SF&lt;/exclude&gt;
                          &lt;exclude&gt;META-INF/*.DSA&lt;/exclude&gt;
                          &lt;exclude&gt;META-INF/*.RSA&lt;/exclude&gt;
                      &lt;/excludes&gt;
                  &lt;/filter&gt;
              &lt;/filters&gt;
          &lt;/configuration&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;phase&gt;package&lt;/phase&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;shade&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                      &lt;transformers&gt;
                          &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/&gt;
                          &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                              &lt;mainClass&gt;com.tapdaq.restapi.HelloWorldApplication&lt;/mainClass&gt;
                          &lt;/transformer&gt;
                      &lt;/transformers&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
      &lt;/plugin&gt;
  
  &lt;/plugins&gt;&lt;/build&gt;
  &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
          &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
          &lt;version&gt;3.0.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
          &lt;artifactId&gt;bson&lt;/artifactId&gt;
          &lt;version&gt;2.13.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mongojack&lt;/groupId&gt;
          &lt;artifactId&gt;mongojack&lt;/artifactId&gt;
          &lt;version&gt;2.1.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
  
          &lt;groupId&gt;io.dropwizard&lt;/groupId&gt;
          &lt;artifactId&gt;dropwizard-core&lt;/artifactId&gt;
          &lt;version&gt;${dropwizard.version}&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>