简体   繁体   中英

Deploying EJB Project to JBoss-AS with Spark dependencies throwing ClassNotFoundException

I'm trying to deploy an EJB project which uses Spark libraries to load to a trained ML model and then make a prediction from there. When I try to deploy the project on my Wildfly server, it throws the error below. I cannot figure out why it's throwing that classnotfoundexception, there is a referenced jar in the project with that package inside: 在此处输入图像描述 Any thoughts on why this error is happening/how to fix it?

Thank you!

Error Message:

20:34:13,864 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."kmeans-ejb.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."kmeans-ejb.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "kmeans-ejb.jar"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:183)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class ec.spark.KMeansStateless with ClassLoader ModuleClassLoader for Module "deployment.kmeans-ejb.jar" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(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:176)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: org/apache/spark/api/java/function/Function
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: org.apache.spark.api.java.function.Function from [Module "deployment.kmeans-ejb.jar" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 18 more

20:34:13,866 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "kmeans-ejb.jar")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"kmeans-ejb.jar\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"kmeans-ejb.jar\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class ec.spark.KMeansStateless with ClassLoader ModuleClassLoader for Module \"deployment.kmeans-ejb.jar\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: org/apache/spark/api/java/function/Function
    Caused by: java.lang.ClassNotFoundException: org.apache.spark.api.java.function.Function from [Module \"deployment.kmeans-ejb.jar\" from Service Module Loader]"}}

May be you are NOT bundled required jar in your war files. Extract your war files and see

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM