Reflection operation problems: OptionalMethodInvoker cannot access KeyUtil(in module java.base) in java17 environment
win-ho opened this issue · 4 comments
I just got a error message from my program as below:
"Reflection operation failed. This is likely due to an internal implementation programming error. Please report this to the JJWT development team. Cause: class io.jsonwebtoken.impl.lang.OptionalMethodInvoker cannot access class sun.security.util.KeyUtil (in module java.base) because module java.base does not export sun.security.util to unnamed module @4812a2ca".
My dev environment: java17 + springboot3 + jjwt 0.12.0.
We are looking into fixing this in the next release, for now you can the following to work around the issue:
--add-opens=java.base/sun.security.util=ALL-UNNAMED
Just a note: so we don't have 'me too' issues and comments, I'll be closing this in favor of #849 since this is a duplicate of the same underlying issue.
Just a note: the reflection code using KeyUtil
has been removed in the 0.12.2 release in favor of a JJWT-native implementation to avoid JPMS scope issues entirely. You shouldn't need --add-opens
now (at least not for JJWT)