我有一个在 Kotlin 中用 vert.x 框架编写的项目。我构建了 jar 文件,我想通过 Docker 运行这个 jar。但是 docker 找不到我的主 Verticle 文件。
Dockerfile:
FROM vertx/vertx3
ENV VERTICLE_NAME OpenApiRoutingVerticle.kt
ENV VERTICLE_FILE build/libs/vertx-kotlin-project-1.0-SNAPSHOT.jar
ENV VERTICLE_HOME /usr/verticles
EXPOSE 8080
COPY $VERTICLE_FILE $VERTICLE_HOME/
WORKDIR $VERTICLE_HOME
ENTRYPOINT ["sh", "-c"]
CMD ["exec vertx run $VERTICLE_NAME -cp $VERTICLE_HOME/* $VERTX_OPTIONS"]
通往我的主垂直的路径
com.mycompany.department.OpenApiRoutingVerticle
PS错误是:
java.lang.IllegalStateException: Cannot find verticle script: OpenApiRoutingVerticle.kt on classpath
at io.vertx.lang.kotlin.KotlinVerticleFactory.createVerticle(KotlinVerticleFactory.kt:28)
at io.vertx.core.impl.DeploymentManager.createVerticles(DeploymentManager.java:229)
at io.vertx.core.impl.DeploymentManager.lambda$doDeployVerticle$2(DeploymentManager.java:202)
at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:76)
at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:171)
at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:143)
at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:131)
at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:665)
at io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer.deploy(VertxIsolatedDeployer.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.vertx.core.impl.launcher.commands.ClasspathHandler.deploy(ClasspathHandler.java:159)
at io.vertx.core.impl.launcher.commands.RunCommand.deploy(RunCommand.java:397)
at io.vertx.core.impl.launcher.commands.RunCommand.run(RunCommand.java:270)
at io.vertx.core.impl.launcher.VertxCommandLauncher.execute(VertxCommandLauncher.java:226)
at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:361)
at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:324)
at io.vertx.core.Launcher.main(Launcher.java:45)