3 Replies Latest reply on Sep 20, 2007 6:18 AM by pmuir

    Two EAR files in one JVM

    wiberto

      I have two seam applications that are deployed in the same JBoss server. Those two EAR files share a common EJB module. One app is an end user app while the other is an admin style app. I'm having issues running both EAR files at the same time.

      This used to worked fine as I have tested both apps at the same time before. I don't remember the combination of server/seam/etc. when this work, so I'm trying to go back and see if I have a version of the code when it worked. It looks to be a problem with the classloader because the error I get is a class cast exception casting the object to itself.

      One thing that makes me think that is that the app that always work is the one that has been either loaded last (when you start the server) or hot deployed last after the server has been started. So it looks like it's grabbing the lastest class and trying to cast it to the one in the other module.

      Has anyone seen this before? I updated to CR1 just to make sure, but the same thing.

      The only strange thing that I notice in the logs besides the ClassCastException is this:

      22:59:50,488 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
      


      I don't know where it comes from, but I'll try to find out.

      Any help is appreciated.

      Thanks,

      Jose

        • 1. Re: Two EAR files in one JVM
          pmuir

          Make sure you put the interfaces on a shared classloader. The warning is just that - no need to worry

          • 2. Re: Two EAR files in one JVM
            wiberto

            These are Entities and I didn't create an interface for any of them. I haven't seen this used a lot in the examples, so I just went the way of just having the Entity class itself.

            How do you go about putting setting classes in certain classloaders. And specificying which classloaders to use and if the are shared or not? I have never had to dig deep into classloaders before, so I'm kind of a rookie there. Any documentation to point me to would be awesome.

            Thanks,

            Jose

            • 3. Re: Two EAR files in one JVM
              pmuir

              You are trying to access the same instance of an entity from two applications at once? I don't think you (or hibernate) can do that. I was assuming you were wanting to communicate using remote interfaces on session beans. EJB3 forum might also be able to help.