Skip to main content
Oct 23, 2023 2:52 PM UTC
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]

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.
Saravanan_Dharmaraj
Saravanan_DharmarajAccepted solution
Community Advisor
Oct 24, 2023 1:04 AM UTC

@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.

 

 

3 replies

Saravanan_Dharmaraj
Community Advisor
Saravanan_DharmarajCommunity AdvisorAccepted solution
Community Advisor
Oct 24, 2023 1:04 AM UTC

@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.

 

 

Translate
kautuk_sahni
Level 9
Oct 26, 2023 8:58 AM UTC

@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.

Translate
Kautuk Sahni
Oct 31, 2023 2:31 PM UTC

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.

Translate