Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1283

java.lang.IllegalAccessError on redeployment using async driver

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: Async
    • Labels:
      None
    • Environment:
      Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
      OS X 10.9.3
      vert.x 2.1

      I have a groovy class, which runs in vert.x that makes use of the java driver:

      	final EventBus eb
      	final Container container
      	final Logger logger
      	final MongoClient mongo
      	final MongoDatabase db
      
      	public Service(EventBus eb, Container container) {
      		this.eb = eb
      		this.container = container
      		logger = container.logger
      
      		mongo = MongoClients.create(new MongoClientURI('mongodb://localhost:27017'), MongoClientOptions.builder().build())
      		logger.info('got mongo client: ' + mongo)
      		db = mongo.getDatabase('mydb')
      		logger.info('got db: ' + db)
      	}
      
      	public void terminate() {
      		mongo.close()
      	}
      

      In case vert.x redeploys the module containing this class I see the following exception:

      got mongo client: org.mongodb.async.MongoClientImpl@6e16e721
      got db: org.mongodb.async.MongoDatabaseImpl@169e0757
      Exception in thread "Thread-6" java.lang.IllegalAccessError: tried to access class org.mongodb.connection.AsynchronousSocketChannelStream$AsyncWritableByteChannelAdapter$1$1 from class org.mongodb.connection.AsynchronousSocketChannelStream$AsyncWritableByteChannelAdapter$1
      	at org.mongodb.connection.AsynchronousSocketChannelStream$AsyncWritableByteChannelAdapter$1.completed(AsynchronousSocketChannelStream.java:183)
      	at org.mongodb.connection.AsynchronousSocketChannelStream$AsyncWritableByteChannelAdapter$1.completed(AsynchronousSocketChannelStream.java:180)
      	at org.mongodb.connection.AsynchronousSocketChannelStream$2.completed(AsynchronousSocketChannelStream.java:140)
      	at org.mongodb.connection.AsynchronousSocketChannelStream$2.completed(AsynchronousSocketChannelStream.java:137)
      	at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
      	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:278)
      	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198)
      	at sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
      	at sun.nio.ch.KQueuePort$EventHandlerTask.run(KQueuePort.java:301)
      	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
      	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)
      

      I have not seen this error when using the synchronous driver. It only showed up when using the async driver.

        1. JAVA-1283_java_only.zip
          273 kB
        2. JAVA-1283.zip
          6.93 MB

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            Steve Hummingbird Steve Hummingbird
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: