Class 未找到:javax/ws/rs/container/AsyncResponse 正在启动 jboss

Class not found: javax/ws/rs/container/AsyncResponse while starting jboss

我必须在我的系统上设置一个现有项目(完全没有支持)。它使用 jboss 作为服务器和 eap 和 war 部署。

我已经创建了所有 wars 和耳朵,并将它们复制到 jboss 的部署文件夹中,但是当我启动 jboss 时,出现以下错误 -

10:27:44,208 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit.myProjectName.ear"."myProjectName2.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."myProject-core-ear-2.1.0.ear"."myProject-client.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of subdeployment "myProject-client.war" of deployment "myProject-core-ear-2.1.0.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_74]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_74]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_74]
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.lhsystems.myProject.server.rest.service.ClientPort with ClassLoader ModuleClassLoader for Module "deployment.myProject-core-ear-2.1.0.ear.myProject-client.war:main" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/container/AsyncResponse
    at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.8.0_74]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) [rt.jar:1.8.0_74]
    at java.lang.Class.getDeclaredMethods(Class.java:1975) [rt.jar:1.8.0_74]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    ... 10 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.container.AsyncResponse from [Module "deployment.myProjectName.ear.myProjectName:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.6.Final-redhat-1]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.6.Final-redhat-1]
    ... 15 more

我在找到这个 class 的罐子时遇到了问题。它应该在我的 JDK 还是某个第三方网络服务库中? 我们在项目中使用了 resteasy,但我在 resteasy jar 中也找不到这个 class。 注意:我们没有使用 Apache CXF。

如有任何帮助,我们将不胜感激。 谢谢

您是否使用 maven 构建工具来打包您的应用程序? 我猜你必须在你的构建中包含一个合适的第 3 方 jar。 对于 Maven,它看起来像

<dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.0.1</version> </dependency>

对于任何其他构建工具(gradle,SBT),您可以访问 https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api/2.0.1