2 Replies Latest reply on Feb 27, 2004 12:12 PM by maksymg

    Deployment problem for two ejb that share the same code

    maksymg

      Hi All,

      I have an ejb1.jar module that by simplicity has a EJBHomeFactory session bean that caches references to other bean homes. The module by itself works fine.

      But I need to include two such modules (driving and driven) in the same application (I have two similar database schema with references to each other). And the driving EJBHomeFactory has reference to the driven EJBHomeFactory. To avoid class duplication, I moved all classes to ejb-classes.jar. Ejb1.jar and ejb2.jar actually contain only descriptive xml files and reference to the ejb-classes.jar. Of course, all beans have unique JNDI names. The application is installed successfully. The driving EJBHomeFactory returns correct references to its module beans. But when I received references to the driven EJBHomeFactory and ask it to return some its entity beans pointed to the second database, it actually returns beans filled with data from the first database (of course if you have records in the tables that share the same primary key). So more interesting it happens only with references to Entity beans. With Session beans I have no problem (it seems). So itÂ’s look like a sophisticate bug either in bean reference or in Entity bean JNDI cache that cache entity beans instances not by JDNI name / primary key, but java.lang.Class instance / primary key.

      So more interesting, if I separate the modules into two applications this bug disappears, but in that case I have problem with class casting.

      My application works fine on WebLogic. I understand that my situation is not common. But may be JBoss developers can fix it in the future. It was tested up to JBoss 3.2.3.

      Best regards,
      Maksym

        • 1. Re: Deployment problem for two ejb that share the same code

          Greetings.

          This may or may not be related to anything, but I'm curious if you specified a commit option in either of the servers.

          cheers.

          • 2. Re: Deployment problem for two ejb that share the same code
            maksymg

            I tested it with commit option A, and B. on JDBC level I use default XA connection to Oracle.

            I guess the problem in my case in that the beans form different ejb modules with different JNDI names share the same class loader and class instance. By the way, can anybody explain me how JBoss ejb container supports pool of ejb instances? Does it separate the pool by "Application/Class Loader/class" or "Application/EJB module/Class Loader/class" (or even Application/EJB module/JNDI name/Class Loader/class). It seems WebLogic supports the second one and as I metioned before it works fine.

            regards