部署Web应用程序时,出现异常NoClassDefFoundError:LocalizableImpl [英] When deploying a web application I get the exception NoClassDefFoundError:LocalizableImpl
问题描述
我有一个包含Web服务的标准J2EE Web应用程序.我正在使用webservices-rt
库来托管服务. [请参阅下面的Maven依赖项].但是,在运行时出现以下异常:
I have a standard J2EE web application that includes web services. I'm using the webservices-rt
library to host the services. [See the maven dependency below]. However, I get the following exception at run time:
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>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
我想念图书馆吗?我尝试添加jaxws-rt
.但是,这需要额外的存储库[jboss
].我对此有些怀疑,因为它在项目中引入了许多新库.
Am I missing a library? I've tried adding jaxws-rt
. However, that requires an additional repo [jboss
]. I'm a bit leery of that, as that it introduces a lot of new libraries into the project.
推荐答案
如果您使用的是Maven,则在项目中添加以下内容即可解决您的问题:
If you are using Maven, add below to your project should solve your problem:
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
</dependency>
您不必添加其他jar,因为它会自动提取其余的依赖项.我更喜欢将jar添加到我的战争中,而不是添加Tomcat lib.我认为它更便携.
You don't have to add others jar because it will automatically pull the rest of dependencies. I prefer to add the jar to my war instead of Tomcat lib. I think it is more portable.
这篇关于部署Web应用程序时,出现异常NoClassDefFoundError:LocalizableImpl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!