vertx-http-service-factory在fat jar

时间:2016-02-15 16:14:47

标签: maven vert.x

要从HTTP部署Verticle,我在vertx-http-service-factory文件中添加了插件pom.xml

<dependency>
    <groupId>io.vertx</groupId>
    <artifactId>vertx-http-service-factory</artifactId>
    <version>3.2.1</version>
</dependency>

然后我像这样部署示例Verticle:

vertx.deployVerticle("https://bintray.com/artifact/download/vietj/testgenrepo/helloworld.zip::helloworld");

我从Eclipse 启动时工作,但是当我从胖JAR 启动时,我有这个错误:

ava.lang.ClassNotFoundException: //bintray.com/artifact/download/vietj/testgenrepo/helloworld.zip::helloworld
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   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.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:521)
   at Scheduler.start(Scheduler.java:22)
   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.ContextImpl.lambda$wrapTask$15(ContextImpl.java:314)
   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(Unknown Source)

似乎vertx-http-service-factory未加载到胖罐中。 可能在pom.xml文件中有一些要修改的内容,但我不知道是什么。有个主意吗?

1 个答案:

答案 0 :(得分:0)

它有效如果我注册 HttpSecureServiceFactory

vertx.registerVerticleFactory(new HttpSecureServiceFactory());

然后你可以从胖JAR部署一个http Verticle:

vertx.deployVerticle("https://bintray.com/artifact/download/vietj/testgenrepo/helloworld.zip::helloworld");