spring-guides / gs-consuming-web-service

Consuming a SOAP web service :: Learn how to create a client that consumes a WSDL-based service
http://spring.io/guides/gs/consuming-web-service
Apache License 2.0
136 stars 164 forks source link

Sample doesn't run under Java 11 #45

Closed sniget closed 4 years ago

sniget commented 4 years ago

This consumer example server doesn't run properly under Java 11, even though the build will pass the smoke test. When running it under gradle and maven the server doesn't last past boot and produces the following:

2020-01-08 16:47:14.406  INFO 8381 --- [           main] c.e.consumingwebservice.CountryClient    : Requesting location for Spain
2020-01-08 16:47:14.412 DEBUG 8381 --- [           main] o.s.ws.client.core.WebServiceTemplate    : Opening [org.springframework.ws.transport.http.HttpUrlConnection@cb0f763] to [http://localhost:8080/ws/countries]
2020-01-08 16:47:14.444 DEBUG 8381 --- [           main] o.s.ws.client.MessageTracing.sent        : Sent request [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}getCountryRequest]
2020-01-08 16:47:14.511 DEBUG 8381 --- [           main] o.s.ws.client.MessageTracing.received    : Received response [SaajSoapMessage {http://schemas.xmlsoap.org/soap/envelope/}Fault] for request [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}getCountryRequest]
2020-01-08 16:47:14.512 DEBUG 8381 --- [           main] o.s.ws.client.core.WebServiceTemplate    : Received Fault message for request [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}getCountryRequest]
2020-01-08 16:47:14.514  INFO 8381 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-01-08 16:47:14.518 ERROR 8381 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:787) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:768) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    at com.example.consumingwebservice.ConsumingWebServiceApplication.main(ConsumingWebServiceApplication.java:15) ~[classes/:na]
Caused by: org.springframework.ws.soap.client.SoapFaultClientException: Implementation of JAXB-API has not been found on module path or classpath.
    at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:830) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:624) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.7.RELEASE.jar:na]
    at com.example.consumingwebservice.CountryClient.getCountry(CountryClient.java:25) ~[classes/:na]
    at com.example.consumingwebservice.ConsumingWebServiceApplication.lambda$lookup$0(ConsumingWebServiceApplication.java:26) ~[classes/:na]
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
    ... 5 common frames omitted

I did also have the producer service running. Worked on trying to get around this for most of the day, and didn't make any headway. Java 11 is a requirement for my purposes.