我在Kotlin中用vert.x框架编写了一个项目。我构建jar文件,我想通过Docker运行这个jar。但码头找不到我的主立面文件。
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.OpenApiRoutingVerticlePS错误是:
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)发布于 2018-05-21 21:18:48
请尝试将行ENV VERTICLE_NAME OpenApiRoutingVerticle.kt替换为ENV VERTICLE_NAME com.mycompany.department.OpenApiRoutingVerticle
kotlin文件被编译成一个.class文件,只要您提供类路径位置,就应该提取该文件。
https://stackoverflow.com/questions/50446572
复制相似问题