question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.10 : JPMS java.base/java.time does not open to jackson

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
GedMarccommented, Mar 6, 2019

OH, yes, p.s. this was because I didn’t include the jdk 8 library - It actually isn’t a problem

0reactions
cowtowncodercommented, Feb 8, 2019

@GedMarc actually, reading back the first message here: are you actually registering the date/time module? BeanSerializer should never be constructed for LocalDate, as there is specific LocalDateSerializer; 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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found