-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
JDK 12+ illegal reflective access operation for Throwable
, setCause()
#2464
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
Comments
Throwable
, setCause()
Throwable
, setCause()
Ah ha! So JDK 12 added Now the question is just how to block attempt(s), if there's a clean way etc. |
Hmmm, I've got 2.10pr2 in production in module-mode on jdk 12 (databind,anno,jaxb,guice) - built JRE I have not seen this at all xD !!! |
Not even in unit tests? Hmmh. Interesting. |
Ok. Will put on hold, need some sort of reproduction. I do not see warnings from |
Inherited a 5 year old project that was built in 1.8. Going through the process of upgrading everything. At this point it's just the tests that fail when Using JDK 13. I'm receiving the same error as well, but related to a creation of an OffsetDateTime instance. Tried versions 2.10.0 and 2.10.0.pr3.
pom.xml (or at least what's relevant)
Since this involves JDK 13 you would rather have this as a separate issue? |
Java.time is in the physical JDK, you will need to add the add-opens clause to your surefire args and startup command lines. No error. |
I think this may actually be slightly different problem: not registering Java 8 date-time module -- in which case "new" Java date/time types were handled as POJOs. And this would trigger the warning. While it would be good to figure out some more graceful way to handle things, I agree with @GedMarc that this is probably not a specific issue to tackle (that is, not for this particular type). But ... maybe it'd make sense to not try force access to Fields, Methods declared in |
Ok. So, have been playing with introspection quite a bit lately, trying to optimize for certain things. Anyway. Will close this for now, will re-file when this or something similar resurfaces. |
Sounds good! I was trying to update this app from 1.8 to 13 and eventually settled on just keeping the thing in 1.8 until actually needed. No errors in 1.8 |
I have an app developed & built with Java 8, but deployed on Java 14 and get this error message when it starts. It appears very repeatable (= has happened every single time that I've looked at the log).
Jackson is getting pulled in from the Play Framework, but I can presumably override the version used (happening in Would be happy to test out any version that's accessible via maven to help get this issue sorted. |
@jxtps Unfortunately this message by JDK is pretty useless as it does not give an idea of value type(s) that trigger this. What typically happens is that something included in JDK is not recognized as something explicitly supported and ends up using general-purpose Bean introspection. To work around this, a specific (de)serializer should be added (or type itself ignored). But to do that, type needs to be known. There are some other things that could be considered, such as maybe adding blocks to prevent all "java.*" types from ever being handled as POJOs; this might help. As to why 2.10.x gives this: it is just because earlier versions do not contain Java 9 module info declarations so JDK will probably treat code in a way as to suppress warnings. |
In my case, this happens with amazon was sdk v1 and databind 2.12.3. Results in runtime exception on Java 16 though, not just warning printout. They try to create an exception from the JSON response like
|
@edudar As usual it'd be necessary to get a reproduction of this: description along is unfortunately not enough. If you can create one, it'd be good to file a separate issue: these typically need to be handled on case-by-case basis as the fundamentally it is not possible to have an overall solution. |
(from mailing list)
This is probably due to deserializer constructed in
BeanDeserializerFactory.buildThrowableDeserializer()
--ThrowableDeserializer
will handle "cause" property by generating a property. It should useinitCause()
, but perhaps there is non-publicsetCause()
accidentally found...The text was updated successfully, but these errors were encountered: