3 Replies Latest reply on Dec 16, 2004 7:40 AM by danieldestro

    Sharing EJBs and classes throught different EARs

    danieldestro

      Hi all,
      I've been searching for the solution to my problem but I am clueless. I hope you guys can help me.

      I have an application called GPA, with some EJBs (Session and MDB) and a web app included. All this is packed as an EAR file. Its structure is something like this:

      EAR
       |-- gpa-ejb.jar (EJBs & interfaces)
       |-- gpa.war (JSPs)
       |-- lib
       | |-- all other JAR files
       |
       |-- META-INF
       |-- application.xml
       |-- jboss-app.xml


      In the MANIFEST.MF file, inside gpa-ejb.jar, I set the Class-Path to some JARs located at the lib folder, that it depends on. All works fine in this app.

      I also have another application called CGE. This app has an EJB, where its configured interfaces (home and remote) are the interfaces that belong to the GPA project (gpa-ejb.jar). CGE's EAR structure is very similiar to GPA's EAR structure.

      But when I deploy CGE, JBoss throws the following exception:

      14:07:14,312 INFO [EjbModule] Creating
      14:07:14,392 INFO [EjbModule] Deploying MyCGEBean
      14:07:14,402 WARN [ServiceController] Problem creating service jboss.j2ee:jndiN
      ame=ejb/MyCGEBean,service=EJB
      java.lang.ClassNotFoundException: my.gpa.interfaces.MyGPAHome
      at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at org.jboss.ejb.StatelessSessionContainer.create(StatelessSessionContai
      ner.java:155)


      Which means: it was not able to find the CGE's EJB interfaces, that belong to GPA.

      How could I indicate that this EJB (from CGE) uses the interfaces from GPA? Which is the best strategy I should use?

      Note: GPA app will call this CGE EJB. One app depends on each other.

      One thing I also tried was to "duplicate" the interfaces (home and remote) in a new jar file, besides other two more common interfaces, and put this jar into CGE's EAR file. But I catch a ClassCastException when GPA invokes CGE's EJB at:

      MyGPAHome home = (MyGPAHome) ctx.lookup("ejb/MyCGEBean");


      I am using JBoss 3.0.3.

      Thank you very much.
      Daniel