Trouble migrating web application from Java 8 to 11 and JEE to JakartaEE - trouble with jaxb

Viewed 220

I encountered big trouble when trying to migration a web application from Java 8 to Java 11.

The web application: The web application provides SOAP web services (using Spring WS), is written in Java 8 and runs on Tomcat 9. Spring 4.3 is used for database access, OXM, MVC and dependency injection.

To build the web services, multiple XSD files are used to auto-generate the class files and WSDL document for the web service interface using the xjc tool from the JDK.

My goal: Migrate the application to Java 11, Tomcat 10 and JakartaEE.

What I have done so far: In the first step, the compiled web application is migrated using Apache migration tool (version 1.0.0) to get it running on Tomcat 10. There is no problem.

Java migration: The next step is, to migrate the source code from Java 8 to 11.

Java 11 does not longer include the tools and libraries for XML binding, which makes it necessary to include the XML bind library from JakartaEE.

Rebuilding the auto-generated class files from the XSD files with xjc, that comes with the library, creates source code, which imports from jakarta.xml.bind instead of javax.xml.bind. (Which should be the correct package).

Using JakartaEEs library also requires some minor changes in the code (changing imports to use jakarta.xml.bind instead of javax.xml.bind)

That's the point, where the trouble begins...

The IDE shows no errors and the code is compiled with no errors. Running the web application shows me the error, that javax.xml.bind.JAXBException was not found.

Since there is no source file, that refers to javax.xml.bind I assume, that a library is the cause. I found many references to that package in the Spring OXM library. But: In the master branch of that library, that these references are still there.

I tries to run JEE XML bind and JakartaEE XML bind at same time, but then Spring WS complains about multiple object factories of same type in same name space (which is not true by the way. Both object factories are generated by xjc for different name spaces and reside in different packages...)

My questions:

  • How can one use JakartaEE, when it is not supported by libraries like Spring?
  • Did I miss something?
  • Can someone give me some hints how to migrate the code?

Best regards,

Markus

0 Answers
Related