javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath. - with linked exception: [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory] | Community
Skip to main content
October 23, 2023
Solved

javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath. - with linked exception: [java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]

  • October 23, 2023
  • 2 replies
  • 25163 views

Writing a test class for the one of the OSGI service using JAXBContext which came with aem-sdk. When executing the service JAXBContext is getting invoked perfectly.. But, from the test class when is calling same line of the actual class its throwing "javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory] " in Intellij Debug. Any suggestions, how can I resolve this issue..

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Saravanan_Dharmaraj

@keerthidundi Could be dependency issue with Intellij, please check the below conversation in Intellij for the same and the solution offered. 

https://youtrack.jetbrains.com/issue/IDEA-199578

https://youtrack.jetbrains.com/issue/TW-76866/javax.xml.bind.JAXBException-Implementation-of-JAXB-API-has-not-been-found-on-module-path-or-classpath.

 

 

2 replies

Saravanan_Dharmaraj
Community Advisor
Saravanan_DharmarajCommunity AdvisorAccepted solution
Community Advisor
October 24, 2023

@keerthidundi Could be dependency issue with Intellij, please check the below conversation in Intellij for the same and the solution offered. 

https://youtrack.jetbrains.com/issue/IDEA-199578

https://youtrack.jetbrains.com/issue/TW-76866/javax.xml.bind.JAXBException-Implementation-of-JAXB-API-has-not-been-found-on-module-path-or-classpath.

 

 

kautuk_sahni
Community Manager
Community Manager
October 26, 2023

@keerthidundi Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
October 31, 2023

Hello everyone, 

I added these dependencies in core/pom.xml file.

<dependency>

<groupId>javax.xml.bind</groupId>

<artifactId>jaxb-api</artifactId>

<version>2.3.1</version>

<scope>test</scope>

</dependency>


<dependency>

<groupId>com.sun.xml.bind</groupId>

<artifactId>jaxb-core</artifactId>

<version>2.3.0</version>

<scope>test</scope>

</dependency>


<dependency>

<groupId>com.sun.xml.bind</groupId>

<artifactId>jaxb-impl</artifactId>

<version>2.3.0</version>

<scope>test</scope>

</dependency>


<dependency>

<groupId>xerces</groupId>

<artifactId>xercesImpl</artifactId>

<version>2.12.2</version>

<scope>test</scope>

</dependency>

Also I invalidate the cache of the intellij. This worked for me. Thank you.