java.lang.ClassNotFoundException: io.vertx.mongo-service

517 views
Skip to first unread message

Zsolt Kovács

unread,
Apr 9, 2015, 1:34:43 PM4/9/15
to ve...@googlegroups.com
Hi,

I am unable to figure out why I get this ClassNotFoundException. I am pretty new to vert-x and mongodb, so probably I am doing something silly. The following gist reproduces the error in my environment when I use the 3.0.0-milestone4 version.

Thanks,

Zsolt



java.lang.ClassNotFoundException: io.vertx.mongo-service
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_31]
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_31]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_31]
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_31]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_31]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_31]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_31]
at io.vertx.core.impl.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:42) ~[vertx-core-3.0.0-milestone4.jar:na]
at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:141) ~[vertx-core-3.0.0-milestone4.jar:na]
at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:105) ~[vertx-core-3.0.0-milestone4.jar:na]
at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:525) ~[vertx-core-3.0.0-milestone4.jar:na]
at org.cristalise.nbkernel.process.Gateway.deployService(Gateway.java:26) ~[eclipseClasses/:na]


Zsolt Kovács

unread,
Apr 9, 2015, 1:36:46 PM4/9/15
to vertx
Sorry, I forgot to copy the code here. Zsolt

import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import io.vertx.core.AsyncResult
import io.vertx.core.Vertx
 
import java.util.function.Consumer
 
@CompileStatic
@Slf4j
class MongoServiceTest {
 
public static void main(String[] args) {
Consumer<Vertx> runner = {
try {
Vertx.vertx().deployVerticle("service:io.vertx.mongo-service") { AsyncResult<String> result ->
if (result.succeeded()) {
log.info("Mongo service was started");
}
else {
log.error("FAILED to start Mongo service", result.cause());
Vertx.vertx().close()
}
}
}
catch (Exception e) {
log.error("FAILED to start Mongo service", e);
Vertx.vertx().close()
}
}
 
runner.accept(Vertx.vertx())
}
}

Julien Viet

unread,
Apr 9, 2015, 6:04:45 PM4/9/15
to ve...@googlegroups.com, Zsolt Kovács
do you have the io.vertx:vertx-service-factory jar on your classpath ?


-- 
Julien Viet
www.julienviet.com
--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tam Nguyen

unread,
Apr 9, 2015, 10:41:26 PM4/9/15
to ve...@googlegroups.com, Zsolt Kovács
This way would be safer,
vertx.deployVerticle(new MongoServiceVerticle(), options, res -> {
...
});

Zsolt Kovács

unread,
Apr 10, 2015, 2:52:35 AM4/10/15
to Julien Viet, vertx
Thanks Julien, that was the issue. To be honest, it is not clear from the mongodb documentation (3.0), that this dependency is needed.

BTW. I see one more issue. Even if Vertx.vertx().close() was called the JVM does not exit. Is that normal?

Zsolt

Zsolt Kovács

unread,
Apr 10, 2015, 3:08:36 AM4/10/15
to Tam Nguyen, vertx
Thanks Tam for the info. That usage is not shown in the mongodb (3.0) documentation. Is that intentional, or just a missing bit?

BTW, if run the test code using the MongoServiceVerticle() I get this exception:

java.lang.IllegalStateException: address field must be specified in config for service verticle

BUT using 'service:io.vertx.mongo-service' throws a different one:

com.mongodb.MongoException: java.io.IOException: Connection  was refused by remote host.

at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:110) ~[mongodb-driver-core-3.0.0-beta3.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127) ~[mongodb-driver-core-3.0.0-beta3.j

From my end user point of view, this 2 approaches are identical, so I would expect them to have the same result. Actually I like the default config approach :)

Zsolt

 

Julien Viet

unread,
Apr 10, 2015, 3:15:55 AM4/10/15
to Zsolt Kovács, vertx

-- 
Julien Viet
www.julienviet.com

On 10 Apr 2015 at 08:52:33, Zsolt Kovács (zs....@gmail.com) wrote:

Thanks Julien, that was the issue. To be honest, it is not clear from the mongodb documentation (3.0), that this dependency is needed.

it should indeed be added in the documentation as a “NOTE”, could you create an issue for that in the project please ?



BTW. I see one more issue. Even if Vertx.vertx().close() was called the JVM does not exit. Is that normal?

I don’t think it should be , perhaps you can provide a “reproducer” for your case ?

Zsolt Kovács

unread,
Apr 10, 2015, 5:44:25 AM4/10/15
to Julien Viet, vertx
Thanks Julien, that was the issue. To be honest, it is not clear from the mongodb documentation (3.0), that this dependency is needed.

it should indeed be added in the documentation as a “NOTE”, could you create an issue for that in the project please ?

BTW. I see one more issue. Even if Vertx.vertx().close() was called the JVM does not exit. Is that normal?

I don’t think it should be , perhaps you can provide a “reproducer” for your case ?

I have updated my original example gist to use deploy MongoServiceVerticle instance without configuration. This throws IllegalStateException which is captured in the handler, but after the close the code does not exit. I am run as java application in eclipse.

Reply all
Reply to author
Forward
0 new messages