question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JAXB-API cannot be found even if I added the dependency in pom.xml

See original GitHub issue

I use JDK 1.8 to test the example codes with IDEA 2020, but JAXB-API cannot be found even if I added the dependecies in pom.xml. The detailed error information is as following:

2020-05-03 12:23:36.951 ERROR 11992 --- [           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.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:768) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at com.example.demo2.Demo2Application.main(Demo2Application.java:14) [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.8.RELEASE.jar:na]
	at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:830) ~[spring-ws-core-3.0.8.RELEASE.jar:na]
	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:624) ~[spring-ws-core-3.0.8.RELEASE.jar:na]
	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) ~[spring-ws-core-3.0.8.RELEASE.jar:na]
	at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.8.RELEASE.jar:na]
	at com.example.demo2.CountryClient.getCountry(CountryClient.java:24) ~[classes/:na]
	at com.example.demo2.Demo2Application.lambda$lookup$0(Demo2Application.java:25) [classes/:na]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784) [spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	... 5 common frames omitted

Could you please help me, thank you!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
litengyaocommented, May 6, 2020

Thank you for your comments. When I met with the problem 6 days ago, I tried to add any necessary dependency to support the code running, but it did not work. The jaxb dependencies that I added in pom.xml were:

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
        </dependency>

Finally, instead, I use apache CXF to implment Web Service developments, which also spports Spring Boot with Java 14. When developing, CXF is easy to integrate with Spring boot and convenient to facilitate developing applications with jax-ws. Thus, it is an alternative solution. Related guide doc can be found at Apache CXF --SpringBoot.

0reactions
bmccann36commented, May 6, 2020

@litengyao I was getting the exact same error as you and was able to fix it. Our root issue may be the same. See this previously closed issue https://github.com/spring-guides/gs-consuming-web-service/issues/40#issuecomment-540584682

In my case it was because server was Java 11 and client was Java 8. The thing that makes this error confusing to debug is that it is not actually with the client code. I would assume that if you tried temporarily commenting out the “lookup” method of type CommandLine runner the app would start up fine and you would get no Error. The error happens when you try to call the server. I think you can still use Java 11 on the server you just have to add the jaxb dependency. See the linked comment for details

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
My preferred solution would be to add an exclusion to the pom.xml file to ignore this specific jaxb-runtime version. <dependency> ...
Read more >
Implementation of JAXB-API has not been found on module ...
1. JAXBException: Implementation of JAXB-API has not been found. Migrate a project to Java 11 and add a Maven JAXB dependency. pom.xml.
Read more >
Compilation issue on GWT 2.8.2 (modular maven project)
By just adding sources to jaxb it will not work. You need to have these sources in a gwt source folder. so it...
Read more >
[Solved] JAXBException: Implementation of JAXB-API has not ...
This JAXBException occurred in your code because on runtime JAXB is not able to find JAXB-API related dependency. ... javax.xml.bind.JAXBException ...
Read more >
Type javax.xml.bind.JAXBContext Exception? - Crunchify
In order to fix this issue you need to manually add below JAXB Maven dependencies to your project. <dependency> <groupId>com.sun.xml.bind</ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found