如何在wildfly 11中上传带有外部jar的Web项目?

问题描述

我需要将我的 Web 项目上传到 Wildfly 11。我第一次尝试在没有外部库的情况下上传我的项目并且它工作正常,但是当我添加新库时,它不再允许我在 Wildfly 11 中上传项目。如果我在 Eclipse IDE 中将它作为 java 运行,则运行良好。我在 Eclipse 中生成了与导出项目的战争,出现的错误如下。

    21:22:43,137 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."ApiPolizaApesegTest.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ApiPolizaApesegTest.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "ApiPolizaApesegTest.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
    at org.jboss.msc.service.ServiceControllerImpl$startTask.startService(ServiceControllerImpl.java:2032)
    at org.jboss.msc.service.ServiceControllerImpl$startTask.run(ServiceControllerImpl.java:1955)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(UnkNown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(UnkNown Source)
    at java.lang.Thread.run(UnkNown Source)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective @R_66_4045@ion for class imp.ws.soatcimtc.rimac.soap.soAPImpl with ClassLoader ModuleClassLoader for Module "deployment.ApiPolizaApesegTest.war" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at org.jboss.as.ee.Metadata.MethodAnnotationAggregator.runtimeAnnotation@R_66_4045@ion(MethodAnnotationAggregator.java:57)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:91)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: com/amazonaws/Request
    at java.lang.class.getDeclaredFields0(Native Method)
    at java.lang.class.privateGetDeclaredFields(UnkNown Source)
    at java.lang.class.getDeclaredFields(UnkNown Source)
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 10 more
Caused by: java.lang.classNotFoundException: com.amazonaws.Request from [Module "deployment.ApiPolizaApesegTest.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
    at org.jboss.modules.ConcurrentClassLoader.performloadClassUnchecked(ConcurrentClassLoader.java:412)
    at org.jboss.modules.ConcurrentClassLoader.performloadClass(ConcurrentClassLoader.java:400)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 15 more

21:22:43,142 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 6) WFLYCTL0013: Operation ("add") Failed - address: ([("deployment" => "ApiPolizaApesegTest.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ApiPolizaApesegTest.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"ApiPolizaApesegTest.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective @R_66_4045@ion for class imp.ws.soatcimtc.rimac.soap.soAPImpl with ClassLoader ModuleClassLoader for Module \"deployment.ApiPolizaApesegTest.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: com/amazonaws/Request
    Caused by: java.lang.classNotFoundException: com.amazonaws.Request from [Module \"deployment.ApiPolizaApesegTest.war\" from Service Module Loader]"}}
21:22:43,144 ERROR [org.jboss.as.server] (External Management Request Threads -- 6) WFLYSRV0021: Deploy of deployment "ApiPolizaApesegTest.war" was rolled back with the following failure message: 
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"ApiPolizaApesegTest.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"ApiPolizaApesegTest.war\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective @R_66_4045@ion for class imp.ws.soatcimtc.rimac.soap.soAPImpl with ClassLoader ModuleClassLoader for Module \"deployment.ApiPolizaApesegTest.war\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: com/amazonaws/Request
    Caused by: java.lang.classNotFoundException: com.amazonaws.Request from [Module \"deployment.ApiPolizaApesegTest.war\" from Service Module Loader]"}}

我觉得我可能不认识外部库,我通过jar添加

解决方法

您需要将“外部库”打包到您的战争中,并使用新战争重新部署应用程序。 另外,WildFly 11 已经很老了,我建议升级到 WildFly 23。