-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Crash] ClassNotFound when running with DEBUG environment variable set to false #1714
Comments
From your stack trace, the issue is not with how your My guess is that you're calling it from an |
As I've explained in the issue body, I'm calling it from an EntryTable.init() block |
After an investigation, I discovered that the following was the issue:
As a result, when the table was accessed for a query by Exposed for the first time, the child object was accessed first, which was trying to access the EntityClass, but the EntityClass tried to access the table which was not initialized yet. As a result, The method of declaring the updateHook was taken from one of the Github issues in the app and was actually used widely in the project before, and we did not notice the catch there. |
Appreciate the investigation done, @Nek-12 ! |
I have faced a ridiculously strange error just now.
I'm using Exposed as my database driver.
I have not set up any logging or other handling.
I have a DEBUG environment variable set in my docker container image.
That environment variable is used throughout the application to mostly configure logging and set Ktor's development mode to true.
The DEBUG environment variable is not used in any way by the Exposed code.
When I build a jar and run it with DEBUG=true, everything works correctly.
As soon as I try to run the app with DEBUG=false, the application crashes when executing a query that tries to fetch a specific entity via a foreign key relation.
The stacktrace is not helpful at all. At first it points to a reflection issue, but then begins to point at a nullpointer exception, and finally, says that my companion object extending UUIDEntityClass is for some reason not found in the bytecode.
The updateHook is a function that is being called in EntryTable.init() block. Here's the content:
The exception arises because the companion object is null or not found for some reason.
I'm using:
I've investigated into what may be causing the bug already.
This bug is NOT related to the usage of gradle version, JDK version and K2 compiler version.
It can be reproduced on my local environment as soon as I set the DEBUG env variable to false, so the docker image is not at fault too.
The jar is being built by the shadow plugin which is used by Ktor internally. The shadow plugin may be at fault here.
The only somewhat related issue I could find is GradleUp/shadow#843
What in the world is going on?
Who is changing what when the DEBUG variable is present so that the bug stops reproducing itself?
The text was updated successfully, but these errors were encountered: