0

I have the following situation:

I have a java application with three projects:

  • Java Project
  • EJB Module
  • Web Project

using net beans, I build the three projects and upload them on the server. The Java Project deploy successfully but the EJB Module which depends on the Java Project gives the following error:

12:35:00,811 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."MyApp.jar".POST_MODULE: org.jboss.msc.service$
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_20]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_20]
        at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_20]


Caused by: java.lang.RuntimeException: Error getting reflective information for class gss.myapp.sessions.CardValidatorBean with ClassLoader ModuleClassLoader for Module "deplo$
        at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
        at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
        at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
        at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        ... 5 more

Caused by: java.lang.NoClassDefFoundError: gss/commons/exceptions/BusinessEntityFindException
        at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_20]
        at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.6.0_20]
        at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.6.0_20]
        at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        ... 10 more

Caused by: java.lang.ClassNotFoundException: gss.commons.exceptions.BusinessEntityFindException from [Module "deployment.MyApp.jar:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 15 more
jens-na
  • 2,254
  • 1
  • 17
  • 22
Alex
  • 5,971
  • 11
  • 42
  • 80

2 Answers2

0

The exception clearly states that it could not find the class gss.commons.exceptions.BusinessEntityFindException

Your ejb jar file MANIFEST.MF should contain the classpath it needs e.g

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_25-b06 (Sun Microsystems Inc.)
Class-Path: your-java-project.jar

and make sure you include your your-java-project.jar in your server classpath.

Sajan Chandran
  • 11,287
  • 3
  • 29
  • 38
  • thanks, however I am not very experienced with jboss, can you please help me to put the values that suits my case in Ant-Version and Created-By – Alex Nov 26 '12 at 13:24
  • I tried to put only this: Manifest-Version: 1.0 Class-Path: myproject.jar and got the following error: java.lang.IllegalArgumentException: Given parent is not an ancestor of this virtual file – Alex Nov 26 '12 at 13:29
  • @Ali Issa check this link http://stackoverflow.com/questions/10152546/jboss-as-7-how-to-make-independant-deployment-of-ejb-and-dependent-war – Sajan Chandran Nov 26 '12 at 13:35
  • in my case, the Dependencies and Class-Path should be the same? myproject.jar? – Alex Nov 26 '12 at 13:40
  • now i am getting this error: New missing/unsatisfied dependencies: service jboss.naming.context.java."MYAPP connection" (missing) dependents: [service jboss.persistenceunit."myproject.jar#myprojectPU"] – Alex Nov 26 '12 at 14:53
0

You need add gss.commons.exceptions.BusinessEntityFindException class to JBoss:

I'll call YOUR_JAR.jar to the jar that contains gss/commons/exceptions/BusinessEntityFindException

1: Add a Module to JBoss

  • Stop your JBoss Server
  • Find YOUR_JAR.jar on your directory
  • Make the next directory on your JBoss: JBOSS_HOME/modules/org/gss/main
  • Put YOUR_JAR.jar on this directory
  • Make a file called module.xml and add:

<

<?xml version="1.0" encoding="UTF-8"?>
 <module xmlns="urn:jboss:module:1.1" name="org.gss">
 <resources>
 <resource-root path="YOUR_JAR.jar"/>
 </resources>
</module>

*

2: Call your new module from your project:

  • On your web project make a file WEB-INF/jboss-deployment-structure.xml
  • add:

<

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
      <dependencies>
         <module name="org.gss" meta-inf="export">
            <imports>
               <include path="META-INF" />
            </imports>
         </module>
      </dependencies>
   </deployment>
</jboss-deployment-structure>
  • start your Jboss Server