-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
script with java.sql.Date reference hits a NoClassDefFoundError when running from compiled jar #13760
Comments
This comment has been minimized.
This comment has been minimized.
@philwalk The section Removed Tools Support for Compact Profiles you mention in your issue description also states the following : "[...] You can use the When targetting JDK 9+ a library developer (e.g. authoring As a first reaction I would say it's not a good idea to modify PS. Based on my experience (I'm coding in Java since JDK 1.O) people must accept that developping under JDK 9+ is a more demanding task. |
Changes that are necessary haven't yet been registered in a bug report, but there is an issue that needs to be addressed:
When testing the minimized code above (with
However, when running the compiled jar directly via |
@philwalk Thanks for the clarification. I can't wait to see the proposed changes and their effect on runtime behavior 😉 |
Updating the Also note the simplified test script above. It can be expected to behave the same way whether the jar is executed internally by The original script would need
|
#14241 provides 2 fixes plus a workaround for this bug.
|
fix 2 problems plus add workaround for #13760
@philwalk should we close it or is you want to continue work on this issue? |
I don't know if we should close it, the underlying problem is still there, and can possibly be fixed the same way #11658 was fixed, by using a different classloader. However, I won't be able to work on it soon. |
PR #15103 provides a fix for this. |
fix for #13760 - running script compiled jar no longer restricted to java.base module
Compiler version
Scala code runner version 3.1.1-RC2 -- Copyright 2002-2021, LAMP/EPFL
The problem occurs when running a script with these runtime java versions:
The problem does NOT occur with java 8
The symptoms are similar to those reported in #11646, although the problem here is restricted to running the compiled jar.
Minimized code
If a script references
java.sql.Date
, aNoClassDefFoundError
occurs, but only when running from a compiled script jar.Here's the test script (notice the
-save
option in the hash bang line):Output
The compile-and-run pass is successful:
But because
-save
is specified, subsequent script runs execute from the compiled jar file, producing the errorjava.lang.NoClassDefFoundError: java/sql/Date
However, there seems to be nothing wrong with the compiled jar itself, which can be run directly by java:
Expectation
A script running from the compiled jar file should behave the same as when doing a compile-and-run.
The text was updated successfully, but these errors were encountered: