Error 404 in Docker but works on local run
Might happen because Kotlin file is not package into jar.
How to solve the problem
Check if you can find all classes and resources package in the jar file:
For java
to find Kotlin runtime classes, the contents of kotlin-reflect.jar
and kotlin-runtime.jar
need to be present in the JAR. Basically, IDEA is unzipping those two files and dumping their content into what will become the JAR. Then IDEA adds the compiler output of our own code.
That KotlinJavaRuntime (Project Library) is automatically generated when we create a new Kotlin project. It is a container that holds all the JAR files that belong to the Kotlin runtime. Check File > Project Structure and then select Libraries. We will find two JARs with binaries and one that holds source code (which will be used when you navigate to the source of a Kotlin runtime class).
If that KotlinJavaRuntime (Project Library) entry is not there, we need to fix that before setting up JAR creation. Tools > Kotlin > Configure Kotlin in Project should do the trick. After that, the Kotlin runtime library object should be available.
Source: https://discuss.kotlinlang.org/t/jar-file-only-works-with-java-classes-but-not-with-kotlin/1487/23
Last updated