[JAVA-1967] IncompatibleClassChangeError: Class com.mongodb.connection.ByteBufferBsonOutput does not implement the requested interface org.bson.io.BsonOutput Created: 16/Sep/15  Updated: 11/Sep/19  Resolved: 17/Sep/15

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 3.0.4
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Noam Dayan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows 10, java 8, Spring 4.2, morphia 1.0.1



 Description   

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); }

 Comments   
Comment by Noam Dayan [ 17/Sep/15 ]

The issue was fixed.
Thanks!

Comment by Jeffrey Yemin [ 16/Sep/15 ]

Try removing this one:

  • C:\Users\GOD\.m2\repository\org\mongodb\bson\2.12.2\bson-2.12.2.jar;
Comment by Noam Dayan [ 16/Sep/15 ]

This is the classpath:
C:\Users\GOD\workspace\tingz\server\ting-backend\target\test-classes;C:\Users\GOD\workspace\tingz\server\ting-backend\target\classes;C:\Users\GOD\Downloads\Dev\Eclipse\eclipse-jee-mars-R-win32-x86_64\eclipse\plugins\org.junit_4.12.0.v201504281640\junit.jar;C:\Users\GOD\Downloads\Dev\Eclipse\eclipse-jee-mars-R-win32-x86_64\eclipse\plugins\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Users\GOD\.m2\repository\org\eclipse\paho\org.eclipse.paho.client.mqttv3\1.0.2\org.eclipse.paho.client.mqttv3-1.0.2.jar;C:\Users\GOD\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\GOD\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.4.1\jackson-core-2.4.1.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\jaxrs\jackson-jaxrs-json-provider\2.4.1\jackson-jaxrs-json-provider-2.4.1.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\jaxrs\jackson-jaxrs-base\2.4.1\jackson-jaxrs-base-2.4.1.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.4.1\jackson-databind-2.4.1.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.4.1\jackson-module-jaxb-annotations-2.4.1.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-joda\2.4.1\jackson-datatype-joda-2.4.1.jar;C:\Users\GOD\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.4.0\jackson-annotations-2.4.0.jar;C:\Users\GOD\.m2\repository\com\sun\jersey\jersey-json\1.18.1\jersey-json-1.18.1.jar;C:\Users\GOD\.m2\repository\org\codehaus\jettison\jettison\1.1\jettison-1.1.jar;C:\Users\GOD\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-impl-2.2.3-1.jar;C:\Users\GOD\.m2\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;C:\Users\GOD\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Users\GOD\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\GOD\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.2\jackson-core-asl-1.9.2.jar;C:\Users\GOD\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.2\jackson-mapper-asl-1.9.2.jar;C:\Users\GOD\.m2\repository\org\codehaus\jackson\jackson-jaxrs\1.9.2\jackson-jaxrs-1.9.2.jar;C:\Users\GOD\.m2\repository\org\codehaus\jackson\jackson-xc\1.9.2\jackson-xc-1.9.2.jar;C:\Users\GOD\.m2\repository\com\sun\jersey\jersey-core\1.18.1\jersey-core-1.18.1.jar;C:\Users\GOD\.m2\repository\org\aspectj\aspectjweaver\1.6.10\aspectjweaver-1.6.10.jar;C:\Users\GOD\.m2\repository\org\hibernate\hibernate-validator\4.2.0.Final\hibernate-validator-4.2.0.Final.jar;C:\Users\GOD\.m2\repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA.jar;C:\Users\GOD\.m2\repository\org\quartz-scheduler\quartz\2.2.0\quartz-2.2.0.jar;C:\Users\GOD\.m2\repository\c3p0\c3p0\0.9.1.1\c3p0-0.9.1.1.jar;C:\Users\GOD\.m2\repository\com\novemberain\quartz-mongodb\1.9.0\quartz-mongodb-1.9.0.jar;C:\Users\GOD\.m2\repository\org\slf4j\slf4j-api\1.6.4\slf4j-api-1.6.4.jar;C:\Users\GOD\.m2\repository\ch\qos\logback\logback-classic\1.0.0\logback-classic-1.0.0.jar;C:\Users\GOD\.m2\repository\ch\qos\logback\logback-core\1.0.0\logback-core-1.0.0.jar;C:\Users\GOD\.m2\repository\org\slf4j\jcl-over-slf4j\1.6.4\jcl-over-slf4j-1.6.4.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-context\4.2.0.RELEASE\spring-context-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-expression\4.2.0.RELEASE\spring-expression-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-context-support\4.2.0.RELEASE\spring-context-support-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-test\4.2.0.RELEASE\spring-test-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\testng\testng\6.1.1\testng-6.1.1.jar;C:\Users\GOD\.m2\repository\org\beanshell\bsh\2.0b4\bsh-2.0b4.jar;C:\Users\GOD\.m2\repository\com\beust\jcommander\1.12\jcommander-1.12.jar;C:\Users\GOD\.m2\repository\org\yaml\snakeyaml\1.6\snakeyaml-1.6.jar;C:\Users\GOD\.m2\repository\cglib\cglib-nodep\3.1\cglib-nodep-3.1.jar;C:\Users\GOD\.m2\repository\com\thoughtworks\proxytoys\proxytoys\1.0\proxytoys-1.0.jar;C:\Users\GOD\.m2\repository\com\sun\jersey\contribs\jersey-spring\1.18.1\jersey-spring-1.18.1.jar;C:\Users\GOD\.m2\repository\com\sun\jersey\jersey-servlet\1.18.1\jersey-servlet-1.18.1.jar;C:\Users\GOD\.m2\repository\com\sun\jersey\jersey-server\1.18.1\jersey-server-1.18.1.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-web\4.2.0.RELEASE\spring-web-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-beans\4.2.0.RELEASE\spring-beans-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-core\4.2.0.RELEASE\spring-core-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\GOD\.m2\repository\org\springframework\security\spring-security-config\4.0.2.RELEASE\spring-security-config-4.0.2.RELEASE.jar;C:\Users\GOD\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\GOD\.m2\repository\org\springframework\security\spring-security-core\4.0.2.RELEASE\spring-security-core-4.0.2.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\security\spring-security-web\4.0.2.RELEASE\spring-security-web-4.0.2.RELEASE.jar;C:\Users\GOD\.m2\repository\joda-time\joda-time\2.5\joda-time-2.5.jar;C:\Users\GOD\.m2\repository\com\google\guava\guava\11.0.1\guava-11.0.1.jar;C:\Users\GOD\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\GOD\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\GOD\.m2\repository\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;C:\Users\GOD\.m2\repository\org\mongodb\bson\2.12.2\bson-2.12.2.jar;C:\Users\GOD\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-aop\4.2.0.RELEASE\spring-aop-4.2.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\social\spring-social-facebook\2.0.1.RELEASE\spring-social-facebook-2.0.1.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\social\spring-social-config\1.1.0.RELEASE\spring-social-config-1.1.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\social\spring-social-web\1.1.0.RELEASE\spring-social-web-1.1.0.RELEASE.jar;C:\Users\GOD\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\GOD\.m2\repository\org\springframework\spring-webmvc\4.0.3.RELEASE\spring-webmvc-4.0.3.RELEASE.jar;C:\Users\GOD\.m2\repository\org\springframework\social\spring-social-core\1.1.0.RELEASE\spring-social-core-1.1.0.RELEASE.jar;C:\Users\GOD\.m2\repository\org\mongodb\morphia\morphia\1.0.1\morphia-1.0.1.jar;C:\Users\GOD\.m2\repository\org\mongodb\mongo-java-driver\3.0.4\mongo-java-driver-3.0.4.jar;C:\Users\GOD\.m2\repository\org\jongo\jongo\1.1\jongo-1.1.jar;C:\Users\GOD\.m2\repository\de\undercouch\bson4jackson\2.4.0\bson4jackson-2.4.0.jar;C:\Users\GOD\.m2\repository\net\sf\sprockets\sprockets\1.5.0\sprockets-1.5.0.jar;C:\Users\GOD\.m2\repository\com\squareup\okhttp\okhttp\2.0.0\okhttp-2.0.0.jar;C:\Users\GOD\.m2\repository\com\squareup\okio\okio\1.0.0\okio-1.0.0.jar;C:\Users\GOD\.m2\repository\com\squareup\okhttp\okhttp-urlconnection\2.0.0\okhttp-urlconnection-2.0.0.jar;C:\Users\GOD\.m2\repository\commons-primitives\commons-primitives\1.0\commons-primitives-1.0.jar;C:\Users\GOD\.m2\repository\commons-configuration\commons-configuration\1.10\commons-configuration-1.10.jar;C:\Users\GOD\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;C:\Users\GOD\.m2\repository\com\sun\jersey\jersey-client\1.18.1\jersey-client-1.18.1.jar;C:\Users\GOD\.m2\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;C:\Users\GOD\workspace\tingz\server\play-crawler\google-play-crawler\target\classes;C:\Users\GOD\.m2\repository\org\apache\httpcomponents\httpclient\4.5\httpclient-4.5.jar;C:\Users\GOD\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\GOD\.m2\repository\net\sourceforge\argparse4j\argparse4j\0.2.2\argparse4j-0.2.2.jar;C:\Users\GOD\.m2\repository\org\apache\httpcomponents\httpcore\4.4.1\httpcore-4.4.1.jar;C:\Users\GOD\.m2\repository\org\apache\httpcomponents\httpclient-cache\4.5\httpclient-cache-4.5.jar;C:\Users\GOD\.m2\repository\org\apache\httpcomponents\httpmime\4.5\httpmime-4.5.jar;C:\Users\GOD\.m2\repository\org\apache\mina\mina-core\2.0.7\mina-core-2.0.7.jar;C:\Users\GOD\.m2\repository\org\slf4j\slf4j-simple\1.7.2\slf4j-simple-1.7.2.jar;C:\Users\GOD\.m2\repository\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\GOD\.m2\repository\com\ganyo\gcm-server\1.0.2\gcm-server-1.0.2.jar;C:\Users\GOD\.m2\repository\com\googlecode\json-simple\json-simple\1.1\json-simple-1.1.jar;C:\Users\GOD\.m2\repository\com\ibm\icu\icu4j\54.1.1\icu4j-54.1.1.jar;C:\Users\GOD\.m2\repository\com\jayway\restassured\rest-assured\2.4.1\rest-assured-2.4.1.jar;C:\Users\GOD\.m2\repository\org\codehaus\groovy\groovy\2.4.3\groovy-2.4.3.jar;C:\Users\GOD\.m2\repository\org\codehaus\groovy\groovy-xml\2.4.3\groovy-xml-2.4.3.jar;C:\Users\GOD\.m2\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\GOD\.m2\repository\org\ccil\cowan\tagsoup\tagsoup\1.2.1\tagsoup-1.2.1.jar;C:\Users\GOD\.m2\repository\com\jayway\restassured\json-path\2.4.1\json-path-2.4.1.jar;C:\Users\GOD\.m2\repository\org\codehaus\groovy\groovy-json\2.4.3\groovy-json-2.4.3.jar;C:\Users\GOD\.m2\repository\com\jayway\restassured\rest-assured-common\2.4.1\rest-assured-common-2.4.1.jar;C:\Users\GOD\.m2\repository\com\jayway\restassured\xml-path\2.4.1\xml-path-2.4.1.jar;C:\Users\GOD\.m2\repository\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar;C:\Users\GOD\.m2\repository\org\objenesis\objenesis\1.0\objenesis-1.0.jar;/C:/Users/GOD/Downloads/Dev/Eclipse/eclipse-jee-mars-R-win32-x86_64/eclipse/configuration/org.eclipse.osgi/382/0/.cp/;/C:/Users/GOD/Downloads/Dev/Eclipse/eclipse-jee-mars-R-win32-x86_64/eclipse/configuration/org.eclipse.osgi/381/0/.cp/

Thanks.

Comment by Jeffrey Yemin [ 16/Sep/15 ]

Seems like a classpath issue. Can you post your classpath please?

Generated at Thu Feb 08 08:55:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.