Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError:javax/xml/bind/JAXBContext

Tags:

java

I'm using JDK 1.5 in my web project and using maven for compile.

I was facing this:

WebServiceException ("javax.xml.ws.WebServiceException: Provider com.sun.xml.ws.spi.ProviderImpl not found")

in my project. To fix that I used two approaches:

  • First, I add jaxws-rt-2.1.4 in my class path.(Also made entry in POM.xml)
  • Second, Added jar in jre/lib folder

But after this I am facing this:

java.lang.NoClassDefFoundError:javax/xml/bind/JAXBContext

Does anyone have any idea that could help me?

like image 925
dinesh sharma Avatar asked Apr 04 '13 11:04

dinesh sharma


2 Answers

Adding a dependency on jaxb-impl should be sufficient, as this transitively depends on jaxb-api, which is the JAR containing the class it's complaining about. In Java 6, javax.xml.bind is part of the JRE by default so it would work out of the box there.

like image 88
Ian Roberts Avatar answered Nov 19 '22 15:11

Ian Roberts


add this dependency to pom

    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.1</version>
    </dependency>
like image 26
Evgeniy Dorofeev Avatar answered Nov 19 '22 14:11

Evgeniy Dorofeev