'Porting from Java 8 to 11: com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found, how to change implementation?
I'm trying to port an old Java 8 webapp containing JAX-WS based webservices to Java 11 and Tomcat 9 on Windows 10. Note that this app is not using Maven or any other dependency management and there are reasons against a conversion.
After adding the jaxws-rt library, I'm getting the following error:
java.lang.Error: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
at com.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:193)
at com.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:91)
at com.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:342)
at com.sun.xml.ws.spi.ProviderImpl.createEndpoint(ProviderImpl.java:107)
at javax.xml.ws.Endpoint.create(Endpoint.java:162)
at javax.xml.ws.Endpoint.create(Endpoint.java:116)
...
The internal
infix already shouldn't be there, as this seems to be a Java 8 package stripped from Java 11. I've tried the following:
- adding the libs
saaj-api-1.3.5.jar
andsaaj-impl-1.5.1.jar
- starting Tomcat with
-Djavax.xml.soap.SAAJMetaFactory=com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl
, which point to a location insaaj-impl-1.5.1.jar
- creating a file
<MyWebapp>/META-INF/services/javax.xml.soap.SAAJMetaFactory
with contentscom.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl
(which btw. is also contained insaaj-impl-1.5.1.jar
)
all to no avail. It keeps asking for that internal implementation which isn't there anymore.
How do I tell Java to use the correct implementation and, if possible, how can I find out who is causing this implementation to show up anyway?
Solution 1:[1]
This worked for me.
I needed to add following dependencies.
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
I also needed to set property.
System.setProperty("javax.xml.soap.MetaFactory","com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | vaske |