com.mongodb.MongoException: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput

JIRA | Noam Dayan | 1 year ago
  1. 0

    I've upgraded my code from morphia version 0.108 to 1.0.1. Now, when I try to connect to my local mongo db (version 3.0.4) I get the following exception: [ting-server-ws] 18:27:13 [cluster-ClusterId{value='55f98a51c811d557f2064f3f', description='null'}-127.0.0.1:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server 127.0.0.1:27017 com.mongodb.MongoException: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:125) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127) ~[mongo-java-driver-3.0.4.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51] Caused by: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput at com.mongodb.connection.RequestMessage.encode(RequestMessage.java:130) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.CommandHelper.sendMessage(CommandHelper.java:88) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongo-java-driver-3.0.4.jar:na] ... 2 common frames omitted My code: MongoClientOptions mongoOptions = MongoClientOptions.builder().connectionsPerHost(mongoConnectionsPerHost).connectTimeout(mongoConnectTimeout) .threadsAllowedToBlockForConnectionMultiplier(mongoThreadsAllowedToBlockForConnectionMultiplier).build(); String[] addresses = mongoHosts.split(","); if (addresses == null || addresses.length == 0) { throw new BeanCreationException("At least one MongoDB address must be specified."); } ArrayList<ServerAddress> listOfAddresses = new ArrayList<ServerAddress>(); try { for (String a : addresses) { listOfAddresses.add(new ServerAddress(a, Integer.parseInt(mongoPort))); } return new MongoClient(listOfAddresses, mongoOptions); } catch (NumberFormatException | MongoException e) { throw new BeanCreationException(e.toString(), e); }

    JIRA | 1 year ago | Noam Dayan
    com.mongodb.MongoException: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput
  2. 0

    I've upgraded my code from morphia version 0.108 to 1.0.1. Now, when I try to connect to my local mongo db (version 3.0.4) I get the following exception: [ting-server-ws] 18:27:13 [cluster-ClusterId{value='55f98a51c811d557f2064f3f', description='null'}-127.0.0.1:27017] INFO org.mongodb.driver.cluster - Exception in monitor thread while connecting to server 127.0.0.1:27017 com.mongodb.MongoException: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:125) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127) ~[mongo-java-driver-3.0.4.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51] Caused by: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput at com.mongodb.connection.RequestMessage.encode(RequestMessage.java:130) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.CommandHelper.sendMessage(CommandHelper.java:88) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43) ~[mongo-java-driver-3.0.4.jar:na] at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongo-java-driver-3.0.4.jar:na] ... 2 common frames omitted My code: MongoClientOptions mongoOptions = MongoClientOptions.builder().connectionsPerHost(mongoConnectionsPerHost).connectTimeout(mongoConnectTimeout) .threadsAllowedToBlockForConnectionMultiplier(mongoThreadsAllowedToBlockForConnectionMultiplier).build(); String[] addresses = mongoHosts.split(","); if (addresses == null || addresses.length == 0) { throw new BeanCreationException("At least one MongoDB address must be specified."); } ArrayList<ServerAddress> listOfAddresses = new ArrayList<ServerAddress>(); try { for (String a : addresses) { listOfAddresses.add(new ServerAddress(a, Integer.parseInt(mongoPort))); } return new MongoClient(listOfAddresses, mongoOptions); } catch (NumberFormatException | MongoException e) { throw new BeanCreationException(e.toString(), e); }

    JIRA | 1 year ago | Noam Dayan
    com.mongodb.MongoException: java.lang.IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput
  3. 0

    Javers + Spring data + Mongo does not work

    GitHub | 2 years ago | swarooprath
    com.mongodb.MongoException: java.lang.IllegalAccessError: tried to access class com.mongodb.MongoNamespace from class com.mongodb.connection.CommandHelper
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    mongodb 3.x driver Android compatibility

    Stack Overflow | 1 year ago | Matteo
    com.mongodb.MongoException: java.lang.NoClassDefFoundError: com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient
  6. 0

    mongodb 3.x driver Android compatibility | FYTRO SPORTS

    fytro.info | 12 months ago
    com.mongodb.MongoException: java.lang.NoClassDefFoundError: com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IncompatibleClassChangeError

      Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput

      at com.mongodb.connection.RequestMessage.encode()
    2. MongoDB Java Driver
      DefaultServerMonitor$ServerMonitorRunnable.run
      1. com.mongodb.connection.RequestMessage.encode(RequestMessage.java:130)[mongo-java-driver-3.0.4.jar:na]
      2. com.mongodb.connection.CommandHelper.sendMessage(CommandHelper.java:88)[mongo-java-driver-3.0.4.jar:na]
      3. com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)[mongo-java-driver-3.0.4.jar:na]
      4. com.mongodb.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:83)[mongo-java-driver-3.0.4.jar:na]
      5. com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:43)[mongo-java-driver-3.0.4.jar:na]
      6. com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)[mongo-java-driver-3.0.4.jar:na]
      7. com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)[mongo-java-driver-3.0.4.jar:na]
      7 frames
    3. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)[na:1.8.0_51]
      1 frame