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

Java 17 support - Illegal reflective access in CustomThrowableTypeAdapter and CheckedExceptionWrapper #647

Open
WellingR opened this issue Oct 26, 2021 · 4 comments

Comments

@WellingR
Copy link

WellingR commented Oct 26, 2021

I tried using the cadence-java-client with java 17. However it appears that the CustomThrowableTypeAdapter uses a reflection method which no longer works in java 17.

The code
https://github.com/uber/cadence-java-client/blob/master/src/main/java/com/uber/cadence/converter/CustomThrowableTypeAdapter.java#L83
Makes the cause field accessible in order to set a non-accessible field to null. This is no longer possible in java 17 because of https://openjdk.java.net/jeps/403 .

Similarly, the initializer of CheckedExceptionWrapper also uses a reflective method which is no longer allowed.

@WellingR WellingR changed the title Java 17 support Java 17 support - Illegal reflective access in CustomThrowableTypeAdapter Oct 26, 2021
@WellingR WellingR changed the title Java 17 support - Illegal reflective access in CustomThrowableTypeAdapter Java 17 support - Illegal reflective access in CustomThrowableTypeAdapter and CheckedExceptionWrapper Oct 26, 2021
@longquanzheng
Copy link
Collaborator

It seems like there are some standard replacements recommended. Would you like to propose some changes to that?

@jontro
Copy link
Contributor

jontro commented Mar 5, 2023

Is it possible to use the same solution as in temporal? temporalio/sdk-java@4bb23c3

Also handling errors seems like a nice fix: temporalio/sdk-java@6653b3d

@agarwall-rohan
Copy link

Is there any solve or alternative proposed for this issue for using uber cadence with Java-17? I am facing java.lang.NoClassDefFoundError: Could not initialize class com.uber.cadence.internal.common.CheckedExceptionWrapper after upgrading to java 17. This should be related to the issue stated above.

@sodre90
Copy link

sodre90 commented Feb 14, 2024

If you include the VM parameter "--add-opens java.base/java.lang=ALL-UNNAMED," it will prevent the exception from being thrown.

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

5 participants