java.lang.NoClassDefFoundError: com/sun/istack/localization/Localizable?
Asked Answered
F

4

25

I try to run my project by tomcat7. after the generation of the wsdl file of my webservices by jax ws maven plugin (and it generated by success) but tried to view the wsdl file in the browser but not result.

I tried to run my project by tomcat7 server but this error appeared and I haven't any solution to this problem this is my error:

août 06, 2013 12:08:09 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments   was not found on the java.library.path: C:\Program   Files\Java\jdk1.7.0_21\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program   Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program   Files\MiKTeX 2.9\miktex\bin;%CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2010a\runtime\win32;C:\Program Files\MATLAB\R2010a\bin;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Orant\bin;C:\Centrun;C:\LHS\BSCS_iX_R2_Demo;C:\LHS\BSCS_iX_R2_Demo\bin\win32;C:\LHS\BSCS_iX_R2_Demo\3pp\win32;C:\LHS\BSCS_iX_R2_Demo\TAO1.3aP12_WinXP\ACE_wrappers\bin;C:\LHS\BSCS_iX_R2_Demo\TAO1.3aP12_WinXP\ACE_wrappers\lib;C:\LHS\BSCS_iX_R2_Demo\jdk1.5.0_06\bin;C:\Program Files\apache-maven-3.1.0\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Users\sayed\Desktop\eclipse\eclipse;;.
 août 06, 2013 12:08:09 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
 WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to    'org.eclipse.jst.j2ee.server:BSCSwebservices' did not find a matching property.
août 06, 2013 12:08:09 PM org.apache.coyote.AbstractProtocol init
 INFO: Initializing ProtocolHandler ["http-bio-8080"]
 août 06, 2013 12:08:09 PM org.apache.coyote.AbstractProtocol init
 INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
 août 06, 2013 12:08:09 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1005 ms
août 06, 2013 12:08:09 PM org.apache.catalina.core.StandardService startInternal
INFO: Démarrage du service Catalina
août 06, 2013 12:08:09 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
août 06, 2013 12:08:10 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO:      validateJarFile(C:\Users\sayed\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\BSCSwebservices\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:   javax/servlet/Servlet.class
 log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
 log4j:WARN Please initialize the log4j system properly.
 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
août 06, 2013 12:08:13 PM org.apache.catalina.core.ApplicationContext log
INFO: Loading Spring root WebApplicationContext
août 06, 2013 12:08:14 PM org.apache.catalina.core.ApplicationContext log
 SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: com/sun/istack/localization/Localizable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.init(WSSpringServlet.java:48)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
  Caused by: java.lang.ClassNotFoundException: com.sun.istack.localization.Localizable
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 21 more

 août 06, 2013 12:08:14 PM org.apache.catalina.core.StandardContext loadOnStartup
 SEVERE: La servlet /BSCSwebservices a généré une exception "load()"
 java.lang.ClassNotFoundException: com.sun.istack.localization.Localizable
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.init(WSSpringServlet.java:48)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Fideicommissary answered 6/8, 2013 at 11:19 Comment(0)
Z
28

Add the jar from where this class com.sun.istack.localization.Localizable is coming .

As the same is present in jaxb-core-2.2.X and jaxb-impl-2.2.X.

Try adding those jars in your server/lib or bundle them with the war file.

Zeculon answered 6/8, 2013 at 11:27 Comment(7)
i added it now but when i write the url of my wsdl file generated by wsgen the same error appearedFideicommissary
i added this jars in server/libFideicommissary
and this jars exited in my pom.xmlFideicommissary
then i don't think you have to add it in server/lib , just make sure that they are getting bundled in your war file(it will happen only when scope of your dependency is compile).Zeculon
i clean my project and t put the wsdl file url (localhost:8080/BSCSwebservices/webservices/…) and the browser shows this message 404 Introuvable : Invalid RequestFideicommissary
Brilliant! I added these two jars (they have to be the same version) to my WEB-INF\lib and it worked fantastically. +1. Note: I also had to update my JAX-WS jars to the same version otherwise new NoClassDef errors would occur. Cheers!Mcripley
In later version you may need to add <dependency> <groupId>com.sun.istack</groupId> <artifactId>istack-commons-runtime</artifactId> <version>${istack.commons.runtime.version}</version> </dependency>Infrequency
K
11

I solved time ago changing maven deps with:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>version</version>
    <exclusions>
        <exclusion>
            <groupId>com.sun.istack</groupId>
            <artifactId>istack-commons-runtime</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Kerwinn answered 6/8, 2013 at 11:25 Comment(1)
This worked, in combination with adding the jaxb-core artifact mentioned in @Youness' answer.Ahriman
P
6

I have face many issues when trying to build a Soap web service running on Tomcat, and for that I've needed many maven dependencies. The configuration that have worked for me is the following:

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

Replace your maven dependencies by these and then make a new try. I hope this works for you too

Psilomelane answered 8/5, 2017 at 15:18 Comment(1)
You are a lifesaver...tried out many solutions but none worked and tried out your solution and worked ! Thanks :)Outset
G
3

com.sun.istack.localization.Localizable.class is definitly in jaxb-core-2.2.11.jar

For running properly your web application, you need to add on your pom.xml:

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

This is for your listner declared on your web.xml:

<listener>
    <listener-class>
        com.sun.xml.ws.transport.http.servlet.WSServletContextListener
    </listener-class>
</listener>

Then, under <%TOMCAT_HOME%>/endorsed (create it if you don't have it) the librairies:

  1. jaxb-impl-2.2.11.jar
  2. jaxb-core-2.2.11.jar
  3. jaxb-api-2.2.3.jar
  4. stax-api-1.0-2.jar
  5. activation-1.1.jar
  6. jaxws-api-2.2.3.jar
  7. saaj-api-1.3.2.jar
  8. javax.annotation-3.1-b35.jar
  9. jsr181-api-1.0-MR1.jar
Griffin answered 21/4, 2016 at 9:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.