Skip to content
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

native-image compile fails when using BABASHKA_FEATURE_JDBC=true #1040

Closed
nikvdp opened this issue Oct 25, 2021 · 5 comments
Closed

native-image compile fails when using BABASHKA_FEATURE_JDBC=true #1040

nikvdp opened this issue Oct 25, 2021 · 5 comments

Comments

@nikvdp
Copy link
Contributor

nikvdp commented Oct 25, 2021

version
Using master (commit 3f5bbdf)

platform
Darwin x86_64
Using GraalVM graalvm-ce-java11-21.2.0

problem
When following the steps in build.md using BABASHKA_FEATURE_JDBC=true the native-image step fails with the following:

Error: Classes that should be initialized at run time got initialized during image building:
 java.sql.SQLException was unintentionally initialized at build time. To see why java.sql.SQLException got initialized use --trace-class-initialization=java.sql.SQLException

repro

git clone --recursive https://github.com/babashka/babashka bb
cd bb
export BABASHKA_FEATURE_JDBC=true
script/uberjar
script/compile

expected behavior
A copy of bb with next.jdbc included gets built

@nikvdp
Copy link
Contributor Author

nikvdp commented Oct 25, 2021

The steps above do build a working bb image when I don't first export BABASHKA_FEATURE_JDBC=true. I've saved the longer output from the script/compile step, glad to post if it'd be helpful!

@borkdude
Copy link
Collaborator

@nikvdp I added this class to init at built time settings, please try again.

@nikvdp
Copy link
Contributor Author

nikvdp commented Oct 25, 2021

@borkdude thanks for the quick response! That changed the output a little bit (now there's a path in the error msg), but seems to be a similar error:

com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 java.sql.SQLException the class was requested to be initialized at run time (from jar:file:///Users/nik/Code/personal/babashka/target/babashka-0.6.3-SNAPSHOT-standalone.jar!/META-INF/native-image/babashka/babashka/native-image.properties with 'java.sql.SQLExcept
ion'). To see why java.sql.SQLException got initialized use --trace-class-initialization=java.sql.SQLException

In case it's relevant, this is what I did to kick off the compile this time:

git pull
rm -rf target
git submodule update --init --recursive
script/uberjar && script/compile

borkdude added a commit that referenced this issue Oct 25, 2021
@borkdude
Copy link
Collaborator

@nikvdp Sorry, my bad, I used the wrong setting. Should be fixed now.

@nikvdp
Copy link
Contributor Author

nikvdp commented Oct 25, 2021

That did it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants