java.lang.NoClassDefFoundError: com/sun/xml/bind/api/TypeReference
Asked Answered
P

1

0

I am trying to compile my maven project, but can't do this. I get this issue:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/bind/api/TypeReference
    at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.typeInfoMappings(JAXBRIContextFactory.java:127)
    at com.sun.xml.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:85)

....skipped...

    at com.ric.st.impl.TaskController.searchTask(TaskController.java:144)
    at com.ric.st.impl.App22.main(App22.java:82)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.api.TypeReference
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 33 more

But my pom includes all libraries, needed for this project:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2.10</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>policy</artifactId>
    <version>2.7.2</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.stream.buffer</groupId>
    <artifactId>streambuffer</artifactId>
    <version>1.5.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb1-impl -->
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb1-impl</artifactId>
    <version>2.2.5.1</version>
</dependency>

How can I correct this issue?

Putout answered 1/8, 2017 at 2:53 Comment(1)
it should be jaxb-impl . instead of jaxb1-implMarijane
B
1

The JAX-WS dependency library “jaxb-impl.jar” is missing. you can try to replace jaxb1-impl by jaxb-impl and you can find dependency below

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.11</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.2.11</version>
    </dependency>
Blanche answered 1/8, 2017 at 5:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.