[Java] Problem with deployVerticle

1,175 views
Skip to first unread message

Valentin Davy

unread,
Jul 7, 2015, 10:47:11 AM7/7/15
to ve...@googlegroups.com
Hello everybody,

I want to use the method deployVerticle of the class Vertx.

Thus, I saw the example there: https://github.com/vert-x3/vertx-examples/tree/master/core-examples/src/main/java/io/vertx/example/core/verticle/deploy
But even with this example, when I use vertx run DeployVerticle, I always receive the following error message:

java.lang.ClassNotFoundException: io.vertx.example.core.verticle.deploy.OtherVerticle
        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)
        at io.vertx.core.impl.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:42)
        at io.vertx.core.impl.DeploymentManager.lambda$doDeployVerticle$163(DeploymentManager.java:142)
        at io.vertx.core.impl.DeploymentManager$$Lambda$5/817348612.handle(Unknown Source)
        at io.vertx.core.impl.FutureImpl.checkCallHandler(FutureImpl.java:135)
        at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:100)
        at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:131)
        at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:103)
        at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:91)
        at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:534)
        at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:506)
        at DeployExample.start(DeployExample.java:30)
        at io.vertx.core.AbstractVerticle.start(AbstractVerticle.java:111)
        at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$169(DeploymentManager.java:407)
        at io.vertx.core.impl.DeploymentManager$$Lambda$6/308433917.handle(Unknown Source)
        at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:314)
        at io.vertx.core.impl.ContextImpl$$Lambda$7/1383519982.run(Unknown Source)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
        at java.lang.Thread.run(Thread.java:745)




I didn't change anything in the two files DeployVerticle.java and OtherVerticle.java except the package line.

Can you see the problem?

Thank you for your help.

Cristian Miranda

unread,
Jul 7, 2015, 10:58:28 AM7/7/15
to ve...@googlegroups.com
What version of Vert.x are you using?

Tim Fox

unread,
Jul 7, 2015, 11:20:33 AM7/7/15
to ve...@googlegroups.com
Try running it from the IDE
--
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.

Clement Escoffier

unread,
Jul 7, 2015, 11:32:30 AM7/7/15
to ve...@googlegroups.com
If you want it to run from the command line, you should do it from target/classes:

vertx run io.vertx.example.core.verticle.deploy.DeployExample 

or set the class path to includes target/classes:

vertx run deploy_example.js -cp ../../../../../../../../../target/classes/

Clement

Valentin Davy

unread,
Jul 8, 2015, 3:48:29 AM7/8/15
to ve...@googlegroups.com
Thank you for your answers:

- I'm using Vert.x3 Christian
- I prefer to use the command line because it's easier for me Tim :D
- Clement, I don't see what you call /target/classes.
I saw the reference in a pom.xml but that's all :/

Tim Fox

unread,
Jul 8, 2015, 3:50:49 AM7/8/15
to ve...@googlegroups.com
On 08/07/15 08:48, Valentin Davy wrote:
Thank you for your answers:

- I'm using Vert.x3 Christian
- I prefer to use the command line because it's easier for me Tim :D

That's fine, but clearly, the example is referencing a Java class so you'll need to compile that first if you insist on running that example from the command line.

If you run it from the IDE, the IDE will automatically compile it for you, so it's simpler.


- Clement, I don't see what you call /target/classes.
I saw the reference in a pom.xml but that's all :/

Valentin Davy

unread,
Jul 8, 2015, 4:06:53 AM7/8/15
to ve...@googlegroups.com
Ah ok, I understand why I should use an IDE but I don't see the reference to a Java class.

Tim Fox

unread,
Jul 8, 2015, 4:12:02 AM7/8/15
to ve...@googlegroups.com
On 08/07/15 09:06, Valentin Davy wrote:
Ah ok, I understand why I should use an IDE but I don't see the reference to a Java class.

Valentin Davy

unread,
Jul 8, 2015, 4:20:34 AM7/8/15
to ve...@googlegroups.com
But, "io.vertx.example.core.verticle.deploy.OtherVerticle" is a java class no?

Or maybe, the method deployVerticle takes class files as parameters?

Tim Fox

unread,
Jul 8, 2015, 4:21:45 AM7/8/15
to ve...@googlegroups.com
On 08/07/15 09:20, Valentin Davy wrote:
But, "io.vertx.example.core.verticle.deploy.OtherVerticle" is a java class no?

Yes, that's a fully qualified class name.

When you run the example it can't find the class because you haven't compiled it.


Or maybe, the method deployVerticle takes class files as parameters?

Valentin Davy

unread,
Jul 8, 2015, 4:29:44 AM7/8/15
to ve...@googlegroups.com
Ok thank you for your help, I'm going to see the different solution I have =)

Valentin Davy

unread,
Jul 10, 2015, 8:17:22 AM7/10/15
to ve...@googlegroups.com
It works, thanks a lot!
I used my IDE and I succeeded in using deployVerticle.

Darshan

unread,
Jun 22, 2017, 4:52:04 AM6/22/17
to vert.x
hi sir,
i m also facing this problem, i compiled it using my IDE, but still failed to deploy the verticle.


SEVERE: Failed in deploying verticle
java.lang.ClassNotFoundException: com.whiteklay.second.app

    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at io.vertx.core.impl.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:42)
    at io.vertx.core.impl.DeploymentManager.createVerticles(DeploymentManager.java:184)
    at io.vertx.core.impl.DeploymentManager.lambda$doDeployVerticle$2(DeploymentManager.java:157)
    at io.vertx.core.impl.FutureImpl.checkCallHandler(FutureImpl.java:188)
    at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:100)
    at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:130)
    at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:102)
    at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:90)
    at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:595)
    at io.vertx.core.Starter.runVerticle(Starter.java:333)
    at io.vertx.core.Starter.run(Starter.java:130)
    at io.vertx.core.Starter.main(Starter.java:101)


i have attched some snapshots so that u can know my problem.

Please Find Attached,

with regards,
Darshan
Screenshot from 2017-06-22 12-48-31.png
Screenshot from 2017-06-22 14-10-16.png
Screenshot from 2017-06-22 14-10-34.png
Screenshot from 2017-06-22 14-12-03.png
Screenshot from 2017-06-22 14-12-25.png
Screenshot from 2017-06-22 14-12-38.png
Screenshot from 2017-06-22 14-16-59.png

Thomas SEGISMONT

unread,
Jun 22, 2017, 5:02:38 AM6/22/17
to ve...@googlegroups.com
com.whiteklay.second.app is just a package name. The verticle class name seems to be com.whiteklay.second.app.secondapp

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/c99dde05-67d3-422e-b0d9-5545444f34d5%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages