2.10 : JPMS java.base/java.time does not open to jackson
See original GitHub issueWhen running in strict naming, java.time package is not exposed
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid type definition for type java.time.LocalDate
: Failed to construct BeanSerializer for [simple type, class java.time.LocalDate]: (java.lang.reflect.InaccessibleObjectException) Unable to make field private final int java.time.LocalDate.year accessible: module java.base does not “opens java.time” to module com.fasterxml.jackson.databind
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to fix jackson java 8 data/time error? - Stack Overflow
1 Answer 1 ... UPDATE: The first solution should be used with jackson-datatype-jsr310 versions 2.x before 2.9 . Since you added version 2.13.3...
Read more >module java.base does not "opens java.time" to unnamed ...
You can fix this issue on your own. add --add-opens java.base/java.time=ALL-UNNAMED as start-argument and it'll work. Here is the corresponding JEP.
Read more >Java 9+ modularity: The difficulties and pitfalls of migrating ...
To illustrate, I'll create a simple project without a module in a JDK 9 or 10 environment. (By the way, this example does...
Read more >Five Command Line Options To Hack The Java Module System
Get your code running on the Java 9 Module System with the command line ... java --add-opens java.base/java.lang=ALL-UNNAMED --class-path ...
Read more >FasterXML/jackson-databind - Gitter
Does Jackson provide an option to safely serialize Map<String, Object> types? ... readValue(ObjectMapper.java:3172) at za.co.bayport.jpms.guicedservlets.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OH, yes, p.s. this was because I didn’t include the jdk 8 library - It actually isn’t a problem
@GedMarc actually, reading back the first message here: are you actually registering the date/time module?
BeanSerializer
should never be constructed forLocalDate
, as there is specificLocalDateSerializer
; and serializing it as POJO does not make too much sense in general.Beyond that, however, I do think there is the question of if and how to avoid attempts at accessing non-accessible accessors from known JDK types – it is possible some JDK types just happen to be working with Java 8 and below, due to use of things like 1-arg constructors, static
valueOf()
methods. So it’d be good to find examples of where this could be problematic, to improve handling. I am thinking, for example, that visibility rules should be overridden for classes under “java.” (knowing it is reserved namespace and access won’t typically work, nor should be required).