JBoss Community

ClassNotFoundException when deploying ear file on Jboss AS 7

created by Catalin Moga in JBoss AS7 Development - View the full discussion

I included my ear file into <jboss_home>\standalone\deployments\ folder.

The ear file was generated with Jboss Developer Studio version 4.0.0.GA.

 

I'm getting following error when starting Jboss 7 as standalone:

 

12:07:08,729 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."<ear_name>.ear".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."<ear_name>.ear".INSTALL: Failed to process phase INSTALL of deployment "<ear_name>.ear"

    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)

    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

    at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]

    at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

Caused by: java.lang.RuntimeException: Error getting reflective information for class <my_class_name>

    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)

    at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:144)

    at org.jboss.as.ee.component.EEClassConfigurationProcessor.processClasses(EEClassConfigurationProcessor.java:133)

    at org.jboss.as.ee.component.EEClassConfigurationProcessor.deploy(EEClassConfigurationProcessor.java:76)

    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)

    ... 5 more

Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Category;

    at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_23]

    at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_23]

    at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_23]

    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57)

    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66)

    ... 9 more

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category from [Module "deployment.<ear_name>.ear.<jar_name>.jar:main" from Service Module Loader]

    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

    ... 14 more

 

 

Following instructions from

https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7

section "How to find the JBoss module dependency"

I searched for the jboss 7 module that contains the class org.apache.log4j.Category

The class is included into following jar: <jboss_home>\modules\org\apache\log4j\main\log4j-1.2.16.jar

From module.xml file I got the module name org.apache.log4j, and I added this module name to the Dependencies in the MANIFEST.MF file:

like Dependencies: org.apache.log4j

 

I did all these steps from the documentation but I still get the same error ClassNotFoundException.

I have tried to update the main MANIFEST.MF file from the ear and also the MANIFEST.MF file from jar included into the ear that requires the class.

 

The MANIFEST.MF file I used is attached.

 

Where is the problem regarding this issue?

Is anything wrong with my configuration for manifest file? I manually edited the manifest file.

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community