I’m Trying to upgrade springboot 2.7.18
to 3.3.1
which includes Spring WS 4.0.11
.
I use WebServiceTemplate
and My configuration is like this:
private WebServiceTemplate buildWebServiceTemplate(WebServiceTemplateBuilder builder, ConfigurationProperties properties) {
return builder.messageSenders(new HttpWebServiceMessageSenderBuilder()
.setConnectTimeout(Duration.ofMillis(properties.getWebServiceConnectionTimeout()))
.setReadTimeout(Duration.ofMillis(properties.getWebServiceReadTimeout())).build())
.build();
}
And I get this error:
Caused by: org.springframework.ws.soap.SoapMessageCreationException: Could not create SAAJ MessageFactory: Unable to create SAAJ meta-factory: class com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to class jakarta.xml.soap.SAAJMetaFactory (com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl and jakarta.xml.soap.SAAJMetaFactory are in unnamed module of loader 'app')
at app//org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:156)
at app//org.springframework.ws.support.DefaultStrategiesHelper.instantiateBean(DefaultStrategiesHelper.java:180)
... 120 more
Caused by: jakarta.xml.soap.SOAPException: Unable to create SAAJ meta-factory: class com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to class jakarta.xml.soap.SAAJMetaFactory (com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl and jakarta.xml.soap.SAAJMetaFactory are in unnamed module of loader 'app')
at app//jakarta.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:73)
at app//jakarta.xml.soap.MessageFactory.newInstance(MessageFactory.java:126)
at app//org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:139)
... 121 more
I have spent a lot of time to figure it out, tried many ways by setting property to replace jakarta.xml.soap
to com.sun.xml.messaging
, I tried downgrading Spring-WS
version to 2.7.0
but still I got the same error