我已经使用Kotlin协程扩展成功创建了一个具有很少数量顶点的阴影罐,并且能够通过vertx run
命令行运行它们,同时指定了我jar的路径,除了在启动时会创建telnet的顶点外壳除外:
java.lang.NoClassDefFoundError: io.vertx.ext.shell.term.TelnetTermOptions
at io.vertx.kotlin.ext.shell.term.TelnetTermOptionsKt.telnetTermOptionsOf(TelnetTermOptions.kt:119)
at io.vertx.kotlin.ext.shell.term.TelnetTermOptionsKt.telnetTermOptionsOf$default(TelnetTermOptions.kt:119)
at **********************.ContactsReceiver.start(ContactsReceiver.kt:20)
at io.vertx.kotlin.coroutines.CoroutineVerticle$start$1.invokeSuspend(CoroutineVerticle.kt:53)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:238)
at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:214)
at kotlinx.coroutines.ExecutorCoroutineDispatcherBase.dispatch(Executors.kt:64)
at kotlinx.coroutines.DispatchedKt.resumeCancellable(Dispatched.kt:413)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:25)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:154)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
at io.vertx.kotlin.coroutines.CoroutineVerticle.start(CoroutineVerticle.kt:51)
at io.vertx.core.Verticle.start(Verticle.java:66)
at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$8(DeploymentManager.java:556)
at io.vertx.core.impl.DeploymentManager$$Lambda$126.0000000063922220.handle(Unknown Source)
at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369)
at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
at io.vertx.core.impl.EventLoopContext$$Lambda$127.0000000060DA8B00.run(Unknown Source)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:510)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:518)
at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:831)
我的项目是使用Gradle(Kotlin DSL)构建的
这些是我的vert.x依赖项:
io.vertx:vertx-core
io.vertx:vertx-lang-kotlin
io.vertx:vertx-lang-kotlin-coroutines
io.vertx:vertx-shell
io.vertx:vertx-auth-shiro
io.vertx:vertx-tcp-eventbus-bridge
我的影子罐任务配置如下:
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
classifier = "fat"
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
minimize()
manifest {
attributes["Main-Verticle"] = vertx.mainVerticle
}
mergeServiceFiles {
include("META-INF/services/io.vertx.core.spi.VerticleFactory")
}
}
似乎不是minimize()
的问题,但重要的是,如果我从main
函数以编程方式部署该vertver,则evrything可以正常工作,并且我获得了telnet shell。
也许我在影子jar任务的清单配置中缺少某些内容?