简体   繁体   English

com.sun.jersey.spi.container.servlet.ServletContainer上的ClassNotFoundException

[英]ClassNotFoundException on com.sun.jersey.spi.container.servlet.ServletContainer

I am migrating project from jBoss-eap-5.1 to jboss-eap-6.0. 我正在将项目从jBoss-eap-5.1迁移到jboss-eap-6.0。 I have defined jersey jars in the modules directory of jboss as follows: 我在jboss的modules目录中定义了球衣罐,如下所示:

com
|_jersey
  |_jersey-core
  |_jersey-client
  |_jersey-server
  |_jersey-servlet

In my project .pom file i defined the jars as follows: 在我的项目.pom文件中,我按如下方式定义了jar:

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-servlet</artifactId>
    <version>1.10</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-core</artifactId>
    <version>${jersey-version}</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-client</artifactId>
    <version>${jersey-version}</version>
    <scope>test</scope>
</dependency>

However, when I try to deploy, I get the following error on ServletContainer class: 但是,当我尝试部署时,我在ServletContainer类上收到以下错误:

13:03:29,908 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit."ApiEar-2.0.0-SNAPSHOT.ear"."ApiService-2.
0.0-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."ApiEar-2.0.0-SNAPSHOT.ear"."ApiService-2.0.0-SNAPSHOT.war".POST_MODULE
: JBAS018733: Failed to process phase POST_MODULE of subdeployment "ApiService-2.0.0-SNAPSHOT.war" of deployment "ApiEar-2.0.0-SNAPSHOT.ear"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_32-ea]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_32-ea]
        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_32-ea]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer from [Modu
le "deployment.ApiEar-2.0.0-SNAPSHOT.ear.ApiService-2.0.0-SNAPSHOT.war:main" from Service Module Loader]
        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:295)
        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:160)
        at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:109)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.1.2.Final-redhat-1.jar:7.1.2.Final-redhat-1]

        ... 5 more

Initially, I was getting this error when I did not define jersey-servlet, but I did some searching, and presumably, jersey-servlet.jar is the one that contains that class. 最初,我没有定义jersey-servlet时遇到此错误,但是我进行了一些搜索,大概是jersey-servlet.jar是包含该类的那个。 However, that did solve the error. 但是,这确实解决了错误。

I have solved the issue by adding this dependencies into my manifest.mf file. 我已经通过将此依赖项添加到manifest.mf文件中解决了该问题。 In my .pom file I added the build plugin: 在我的.pom文件中,添加了构建插件:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    <configuration>
         <archive>
             <manifestEntries>
                  <Dependencies>com.jersey.jersey-server,com.jersey.jersey-client,com.jersey.jersey-json</Dependencies>
             </manifestEntries>
         </archive>
    </configuration>
</plugin>

that added references to the needed .jar files in my manifest file 在清单文件中添加了对所需.jar文件的引用

没有答案,但是我相信这是在10版的jersey中实现的。那是对图书馆进行大修的时候

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jboss as 7 + jersey - ClassNotFound com.sun.jersey.server.impl.container.servlet.Include - jboss as 7 + jersey - ClassNotFound com.sun.jersey.server.impl.container.servlet.Include java.lang.NoSuchMethodError:com.sun.jersey.core.spi.factory.MessageBodyFactory。 <init> (Lcom / sun / jersey / core / spi / component / ProviderServices;)V - java.lang.NoSuchMethodError: com.sun.jersey.core.spi.factory.MessageBodyFactory.<init>(Lcom/sun/jersey/core/spi/component/ProviderServices;)V com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException解析POST中的XML(Java Servlet) - com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException parsing XML in POST (Java Servlet) java.lang.NoClassDefFoundError:无法初始化com.sun.jersey.core.header.MediaTypes类 - java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.core.header.MediaTypes 部署jsp / servlet Web应用程序“ com.sun.faces.config.ConfigureListener”时,Jboss错误 - Error with Jboss while deploying a jsp/servlet web app “com.sun.faces.config.ConfigureListener” Error ClassNotFoundException:迁移到JBoss 7.1.1时为sun.net.www.MimeTable - ClassNotFoundException: sun.net.www.MimeTable when migrating to JBoss 7.1.1 为什么在 Wildfly 中出现 com/sun/rowset/CachedRowSetImpl 的 NoClassDefFoundError? - Why NoClassDefFoundError for com/sun/rowset/CachedRowSetImpl in Wildfly? 带有jboss 5.1的richfaces-deploy-&gt; ClassNotFoundException context.spi.context - richfaces with jboss 5.1 - deploy-> ClassNotFoundException context.spi.context 由java.lang.ClassNotFoundException引起的钝化错误:org.jboss.wsf.spi.serviceref.ServiceRefMetaData - Passivation error caused by java.lang.ClassNotFoundException: org.jboss.wsf.spi.serviceref.ServiceRefMetaData 在 Jboss 中找不到 com.sun.jdi - Can't find com.sun.jdi in Jboss
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM