java NoClassDeFoundError WSServletContextListener 和 XMLStreamBuffer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6127386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NoClassDeFoundError WSServletContextListener and XMLStreamBuffer
提问by user373455
I'm getting the following error while trying to deploy a JAX-WS Maven-project to JBOSS6.0.0.
尝试将 JAX-WS Maven 项目部署到 JBOSS6.0.0 时出现以下错误。
17:45:03,451 ERROR [[/isp]] Error configuring application listener of class com
sun.xml.ws.transport.http.servlet.WSServletContextListener: java.lang.NoClassDe
FoundError: javax/servlet/ServletContextAttributeListener
at java.lang.ClassLoader.findBootstrapClass(Native Method) [:1.6.0_24]
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:927)
[:1.6.0_24]
...
My Pom-file has the following as dependency:
我的 Pom 文件具有以下依赖项:
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
<scope>provided</scope>
</dependency>
I tried putting the jar-file in common/lib, /lib, or /lib/endorsed but still get the same.
A lot of people had this problems and there's quite some answer but nothing I found and tried worked.
我尝试将 jar 文件放在 common/lib、/lib 或 /lib/endorsed 中,但仍然得到相同的结果。
很多人都遇到了这个问题,并且有很多答案,但我发现并尝试过的都没有奏效。
Update
So, I tried putting the lib in WEB-INF/lib instead. And that takes away the previous error. However, a new error is now showing up. Here's the stack trace:
更新
因此,我尝试将 lib 放在 WEB-INF/lib 中。这消除了之前的错误。但是,现在出现了一个新错误。这是堆栈跟踪:
09:00:46,353 ALLVARLIG [http] WSSERVLET11: failed to parse runtime descriptor: j
ava.lang.NoClassDefFoundError: com/sun/xml/stream/buffer/XMLStreamBuffer: java.l
ang.NoClassDefFoundError: com/sun/xml/stream/buffer/XMLStreamBuffer
at com.sun.xml.ws.server.EndpointFactory.generateWSDL(EndpointFactory.ja
va:424) [:2.1.4]
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.
java:196) [:2.1.4]
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467) [:2.
回答by user373455
Well this was ridiculous.
好吧,这太荒谬了。
I added all jar-files from the JAXWS-rt download (http://jax-ws.java.net/2.2.1/) and copied all of the jar-files in the /lib catalog into JBOSS_HOME/servers/default/lib.
我从 JAXWS-rt 下载 (http://jax-ws.java.net/2.2.1/) 添加了所有 jar 文件,并将 /lib 目录中的所有 jar 文件复制到 JBOSS_HOME/servers/default/库
Worked good after that. Still can't believe I dry humped this for so long.
在那之后工作得很好。还是不敢相信我干了这么久。
Well, all good now.
嗯,现在一切都很好。
回答by GMsoF
Your POM dependency should work, just remove:
您的 POM 依赖项应该可以工作,只需删除:
<scope>provided</scope>
If you define it as scope, it means your server will provide the jars, which, this is not the case for Tomcat.
如果您将其定义为范围,则意味着您的服务器将提供 jar,而 Tomcat 则不是这种情况。
回答by paul
I had a similar problem. My POM contained
我有一个类似的问题。我的 POM 包含
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.2</version>
<type>pom</type>
</dependency>
and I was getting com.sun.xml.ws.transport.http.servlet.WSServletContextListener
class not found.
我正在com.sun.xml.ws.transport.http.servlet.WSServletContextListener
上课找不到。
I removed <type>pom</type>
and the server started without error. The web service also functions correctly.
我删除<type>pom</type>
并且服务器启动没有错误。Web 服务也能正常运行。