Moving older project away from jdk8 I need to fix jaxb. Most of answers are for older versions, while I want to fix it to current versions and I'm kinda struggling with naming mess / dependency hell of javax.xml / jakarta.xml
I thought I moved away from saaj-impl 1.5.1 to newer 2.0.1 for for some reason during startup there is still search for com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl instead of com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl which is on classpath.
The produced message is:
javax.xml.soap.SOAPException: Provider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
but I cannot figure out, how to stop this from kicking in. It seems, that library javax.xml.soap-api looks for javax.xml.soap.SAAJMetaFactory implementation, but configuration file for service loader is not present, so default will kick in. It's not present, because the service-loader file present on class path is jakarta.xml.soap.SAAJMetaFactory and not javax.xml.soap.SAAJMetaFactory. I'd guess that jaxws-api brings javax.xml.soap.api, which is then in conflict.
My post-jdk8 jaxb dependencies are:
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>2.0.1</version>
</dependency>
but this did not change a thing. So I tried replace jaxws-api with:
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.soap</groupId>
<artifactId>jakarta.xml.soap-api</artifactId>
<version>3.0.0</version>
</dependency>
but that just makes tons of other classes missing. It's really cryptic and puzzling.
Can someone advise:
- what is preferred nowadays? Jakarta or javax? What shall I aim for?
- what is correct, winning combination of these dependencies with up-to-date versions? I don't want to see in dependencies something being 4y old.