Vert.x mongo examples NoClassDefFoundError

325 views
Skip to first unread message

aleks...@googlemail.com

unread,
Nov 22, 2016, 3:57:43 AM11/22/16
to vert.x
Hi,
I was just playing around with the latest vert.x examples, especially the mongo example. Therefore I have downloaded the examples and executed the MongoClientVerticle. Executing the class leads to a NoClassDefFoundError as you can see:

java.lang.NoClassDefFoundError: com/mongodb/connection/StreamFactoryFactory
at com.mongodb.async.client.MongoClientSettings.builder(MongoClientSettings.java:69)
at io.vertx.ext.mongo.impl.config.MongoClientOptionsParser.<init>(MongoClientOptionsParser.java:40)
at io.vertx.ext.mongo.impl.MongoClientImpl$MongoHolder.mongo(MongoClientImpl.java:708)
at io.vertx.ext.mongo.impl.MongoClientImpl.<init>(MongoClientImpl.java:77)
at io.vertx.ext.mongo.MongoClient.createShared(MongoClient.java:66)
at io.vertx.examples.mongo.MongoClientVerticle.start(MongoClientVerticle.java:36)
at io.vertx.core.AbstractVerticle.start(AbstractVerticle.java:111)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:434)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:316)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:440)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.mongodb.connection.StreamFactoryFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more

Downgrading to vertx version 3.2.1 leads to a working example. Does somebody have faced the same issue? Or am I doing something wrong?

Regards

Aleks

Martijn Verburg

unread,
Nov 22, 2016, 4:04:26 AM11/22/16
to ve...@googlegroups.com
I think that's a bug in the example code, can you raise an issue in Github?

Cheers,
Martijn

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/df86df2e-8a4d-4378-9d4b-002d1020827d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aleks...@googlemail.com

unread,
Nov 22, 2016, 4:41:10 AM11/22/16
to vert.x
Hi Martijn,
thanks for your fast response. Is this bug related only to the examples or also for the implementation? I have created a reproducer, actually it is the same code from the examples with the latest version of vert.x. Executing this reproducer I get the same exception.

Regards,
Aleks

Cheers,
Martijn

To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
mongo-example.zip

Martijn Verburg

unread,
Nov 23, 2016, 4:14:59 AM11/23/16
to ve...@googlegroups.com
Hi Aleks,

Thanks for your reproducer!  Unfortunately it works perfectly for me, no java.lang.NoClassDefFoundError is thrown...

That Interface does exist in the mongodb-driver-core-3.2.2.jar file, can you check in your project whether that's being pulled in?



Cheers,
Martijn

To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.

aleks...@googlemail.com

unread,
Nov 23, 2016, 4:22:03 AM11/23/16
to vert.x
Hi Martin,
thank for testing the reproducer. Actualy the interface does exist, but then it looks to me that somehow my project is corrupt and can not read that interface. I am going to investigate that and let you know.

Cheers,
Martijn

Martijn Verburg

unread,
Nov 23, 2016, 8:03:41 AM11/23/16
to ve...@googlegroups.com
clearing any mongo libs from your .m2/repository may help...

Cheers,
Martijn

To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.

aleks...@googlemail.com

unread,
Nov 23, 2016, 9:00:40 AM11/23/16
to vert.x
Hi Martin,
actually this solved the problem. 
Thanks for your fast responses.

SOLVED

Cheers,
Martijn

Martijn Verburg

unread,
Nov 24, 2016, 5:34:02 AM11/24/16
to ve...@googlegroups.com
Glad to hear it :-)

Cheers,
Martijn

To unsubscribe from this group and stop receiving emails from it, send an email to vertx+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages