When deploying a web application, I get a NoClassDefFoundError exception: LocalizableImpl

I have a standard J2EE web application that includes web services. I use the library webservices-rtto host services. [Cm. Dependence on maven below]. However, at runtime, I get the following exception:

SEVERE: Exception sending context initialized event to listener instance of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener
java.lang.NoClassDefFoundError: com/sun/xml/ws/util/localization/LocalizableImpl
    at com.sun.xml.ws.util.exception.JAXWSExceptionBase.<init>(JAXWSExceptionBase.java:63)
    at com.sun.xml.ws.transport.http.servlet.WSServletException.<init>(WSServletException.java:47)
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [...]
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.util.localization.LocalizableImpl
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 33 more

Maven WS Dependency

    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>webservices-rt</artifactId>
        <version>1.4</version>
        <scope>compile</scope>
    </dependency>

Am I missing a library? I tried to add jaxws-rt. However, this requires an additional repo [ jboss]. I am a little inclined to this, as it introduces many new libraries into the project.

+5
source share
4 answers

JBoss . .

, , , . JBoss, JBoss.

0

JAX-WS "jaxws-rt.jar" .

http://jax-ws.java.net/.

JAX-WS RI.

"jaxws-rt.jar" Tomcat "{$ TOMCAT}/lib".

Tomcat.

0

For maven, tomcat application try these dependencies in your pom.xml

<dependencies>
    <!-- jax-ws maven dependency -->
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.2.8</version>
    </dependency>
    <!-- servlet provided by tomcat -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-core -->
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.2.7</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.xml.stream.buffer/streambuffer -->
    <dependency>
        <groupId>com.sun.xml.stream.buffer</groupId>
        <artifactId>streambuffer</artifactId>
        <version>1.5.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.7</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.xml.ws/policy -->
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>policy</artifactId>
        <version>2.3.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.glassfish.gmbal/gmbal-api-only -->
    <dependency>
        <groupId>org.glassfish.gmbal</groupId>
        <artifactId>gmbal-api-only</artifactId>
        <version>3.2.0-b003</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.glassfish.ha/ha-api -->
    <dependency>
        <groupId>org.glassfish.ha</groupId>
        <artifactId>ha-api</artifactId>
        <version>3.1.9</version>
    </dependency>
</dependencies>

I hope this works for new people who will run into this problem.

Hi

0
source

If you are using Maven, add below so your project solves your problem:

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

You do not need to add other jar files because they automatically pull the rest of the dependencies. I prefer to add a jar to my war instead of Tomcat lib. I think it is more portable.

0
source

All Articles