Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

3.4K
Visualizações
What does this error mean? java.lang.reflect.InaccessibleObjectException: Unable to make field private final int java.time.LocalDate.year

I'm trying to make a method, which uses the Json data with jackson library to have a list of objects. If I run my code, I get the error:

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 unnamed module @5c90e579

Why is it giving me an error about LocalDate even though I have JodaModul in my Code?

public static List<Tweet> getTweetsFile() throws Exception{

            ObjectMapper mapper = new ObjectMapper().
                    registerModule(new JodaModule()).
                    configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
            
            File path = new File ("C:/Users/PC/eclipse-workspace/hw4/tw.json");

            List<Tweet> myObjects3 =  Arrays.asList(mapper.readValue(path, Tweet.class));
    
            return myObjects3;
    }

How it looks in my File:

[{"date":"2001-12-28","tweetNumber":1,"country":"England","comments":11,"message":"I like to watch anime and reading books","retweets":3,"username":"Isabelle","likes":55},{"date":"2003-05-11","tweetNumber":2,"country":"France","comments":25,"message":"I'm Viatnamese, but I live in France","retweets":30,"username":"Vin","likes":110}..

It's not in the right order like my Object has in their constructor, could that be the reaseon?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I solved this problem to change jdk16 to jdk11.

over 4 years ago · Santiago Trujillo Relatório

0

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

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda