eclipsemavenjbosswildflyjboss-eap-7

Getting reflective infomation error when deploying a .jar to jboss eap 7


I'm trying to deploy a ejb jar file to jboss eap 7.0.0 as a maven project. The project uses Config-1.3.1.jar as a dependency which I have added to the pom.xml of my project. I'm new to jboss and maven so I don't really know what I'm doing wrong here. Here's the pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>xxx.xxx.xxx</groupId>
    <artifactId>xxx-xxx-xxx-xxx</artifactId>
    <version>xxx</version>
</parent>

<artifactId>xxx-xxx-xxx-ejb</artifactId>
<name>xxx-xxx-xxx-ejb</name>
<packaging>jar</packaging>

<dependencies>
    <dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.2_spec</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.1-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.logging</groupId>
        <artifactId>jboss-logging</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.typesafe</groupId>
        <artifactId>config</artifactId>
        <version>1.3.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.javatuples</groupId>
        <artifactId>javatuples</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <finalName>xxx-xxx-xxx-ejb</finalName>
</build>

But when I try to deploy the jar to jboss, I get the error(s):

09:50:44,211 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) 
MSC000001: Failed to start service jboss.deployment.unit."xxx-xxx-xxx-ejb.jar".POST_MODULE: 
org.jboss.msc.service.StartException in service jboss.deployment.unit."xxx-xxx-xxx-ejb.jar".POST_MODULE: WFLYSRV0153: Failed to 
process phase POST_MODULE of deployment "xxx-xxx-xxx-
ejb.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class xxx.mbean.ConfigCache with ClassLoader ModuleClassLoader for Module "deployment.xxx-xxx-xxx-ejb.jar:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
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:147)
... 5 more
Caused by: java.lang.NoClassDefFoundError: com/typesafe/config/Config
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:80)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66)
... 10 more
Caused by: java.lang.ClassNotFoundException: com.typesafe.config.Config from [Module "deployment.xxx-xxx-xxx-ejb.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 15 more

Does anyone know what I'm doing wrong here? I'd be happy to post more information if needed.


Solution

  • You need to find a way to make the classes in this dependency:

    <dependency>
        <groupId>com.typesafe</groupId>
        <artifactId>config</artifactId>
        <version>1.3.1</version>
        <scope>provided</scope>
    </dependency>
    

    and possibly this one:

    <dependency>
        <groupId>org.javatuples</groupId>
        <artifactId>javatuples</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>
    

    available to your EJB jar.

    This is normally accomplished by packaging these jars together with your EJB jar into an EAR file.

    Alternatively you could use one of the methods described in Class Loading in WildFly 10.

    Ultimately it depends on what your EJBs do and where their clients (if any) happen to be deployed.

    For example it may be easier to change your project's packaging type to:

    <artifactId>xxx-xxx-xxx-ejb</artifactId>
    <packaging>war</packaging>
    

    so that your dependencies get added in the WEB-INF/lib directory (if you remove the provided scope), which is a lot easier than composing an EAR file.

    Java EE 6 and 7 permit EJBs to be deployed in WAR files.