I need to upgrade my app from Java 8 to Java 17. We have some unmarshallers using JaxbContext
JAXBContext jaxbContext = JAXBContext.newInstance(Order.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
// Unmarshal the XML file into an Order object
Order order = (Order) jaxbUnmarshaller.unmarshal(file);
The method works properly in Java 8 but in Java 17 I am getting the members present inside order to be null.
Note: I tried using the dependencies below but they did not help. Also I have EclipseLink as a Jpa Provider.
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- JAXB Runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>3.0.2</version>
</dependency>
<!-- Optional: If you are using Java 9 or above, you might need the following dependency -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>