5 Replies Latest reply on Sep 21, 2009 11:28 AM by wluque

    NameAlreadyBoundException when migrate from JBoss 4.2.2.GA t

    wluque

      Hi , in first time sorry for mi english !

      I have multiple ear's sharing one EJB . This EJB is deployed in one each ear .

      EAR-A
      war
      ejb-a
      ejb-shared

      EAR-B
      war
      ejb-b
      ejb-shared

      I need only one instance/reference of ejb-shared , and I use @LocalBinding(jndiBinding="X") for that in the ejb's in ejb-shared.jar .

      So , that's work fine for mi in JBoss 4.2.2.GA , no errors , and only one instance of my ejb-shared is reference for all ear's .

      But , when migrate to JBoss 5.1.0.0.GA that's not work and I have the "NameAlreadyBoundException " for all ejb in the ejb-shared.jar in the second deployed EAR .

      I can't find help about that .

      can anyone help me?

      thank you very much in advance!!

        • 1. Re: NameAlreadyBoundException when migrate from JBoss 4.2.2.
          jaikiran

           

          I need only one instance/reference of ejb-shared , and I use @LocalBinding(jndiBinding="X") for that in the ejb's in ejb-shared.jar .


          If there are more than one bean trying to bind to the same JNDI name then an exception will be thrown as you have seen.

          So , that's work fine for mi in JBoss 4.2.2.GA , no errors , and only one instance of my ejb-shared is reference for all ear's


          That probably was a bug - i guess it used to overwrite the earlier bound instance with the second instance.

          I have multiple ear's sharing one EJB


          I would suggest that you deploy that bean only once, separately.


          • 2. Re: NameAlreadyBoundException when migrate from JBoss 4.2.2.
            wluque

            Hi jaikiran, thank you for you prompt reply and you help.

            i think too it used to overwrite the earlier bound instance with the second instance.

            You say that is a bug in Jboss 5.1 ? or JBoss 4.2 ?

            I will try to restructure my application to deploy ejb-shared only once. But it is not simple, because I have entities that's extend the entities in the ejb-shared, and not whether it will work if I remove the ejb-shared from the EAR.

            I will try...

            Best Regards

            • 3. Re: NameAlreadyBoundException when migrate from JBoss 4.2.2.
              wluque

              ok ,
              First I will explain more about the structure of my application.

              I have a EAR ( FMK ) with the basic components of my business application : security aspects , service daemons .. etc . and Statics singleton class cache of my system activities .. and more ...

              FMK-EAR
              --> fmk.war ( seam 2.2 ) PLATFORM CONSOLE
              --> fmk-seam.jar (ejb) ( My seam's basic actions )
              --> fmk-serviceEjb.jar (ejb) ( My plattaform services )
              --> fmk-entities.jar (ejb/persistence) ( My basic plattaform entities / persitence unit)

              DC-EAR ( Application over my FMK platform)
              --> dc.war ( seam 2.2 . Utilice dc-seam/fmk-seam )
              --> dc-seam.jar (ejb) ( seam actions specific of dc )
              --> dc-serviceEjb.jar (ejb) ( services of dc / call too fmk-serviceEjb )
              ---> dc-entities.jar (ejb/persistence) extends BasicEntities of Fmk
              --> fmk-seam.jar
              --> fmk-serviceEjb.jar
              --> fmk-entities.jar

              this works fine in JBoss 4.2.2 , now when migrated to JBoss 5.1 i have two errors :

              First error ( this post ) , before I have only one instance of de fmk-serviceEjb.jar (ejb) , now Error in duplicated Name .

              Second Error : Deploy order of my FMK-EAR . My fmk-serviceEjb.jar (ejb) is deployed in the first time and not find my persistence unit .

              I already tried everything for several weeks and I'm lost ...

              Could you help me with any suggestions?

              Thank You !

              • 4. Re: NameAlreadyBoundException when migrate from JBoss 4.2.2.
                wluque

                Now I have trouble with persistence.xml .
                In my application :

                FMK-EAR
                --> fmk.war ( seam 2.2 ) PLATFORM CONSOLE
                --> fmk-seam.jar (ejb) ( My seam's basic actions )
                --> fmk-serviceEjb.jar (ejb) ( My plattaform services )
                --> fmk-entities.jar (ejb/persistence) ( My basic plattaform entities / persitence unit)

                Case 1 :

                If I put the file persistence.xml in the FMK-EAR/META-INF , I have the error : ClassNotFound

                http://www.jboss.org/index.html?module=bb&op=viewtopic&t=161236

                Case 2 :

                If I put the file persistence.xml in the fmk-entities.jar , I have the error in fmk-serviceEjb.jar with @EntityPersister(name="ejb3FMK") , error : PersistenceUnit ejbFMK not found .

                Appreciate any help !

                • 5. Re: NameAlreadyBoundException when migrate from JBoss 4.2.2.
                  wluque

                  Hi , I fixed it this way :

                  fmk-entities.jar (ejb/persistence) ->> convert to a Java Project (POJO) .

                  Move persistence.xml to EAR/META-INF .
                  and Add <jar-file>fmk-entities.jar</jar-file>

                  My final arquitecture.

                  FMK-EAR
                  --> fmk.war ( seam 2.2 ) PLATFORM CONSOLE
                  --> fmk-seam.jar (ejb) ( My seam's basic actions )
                  --> fmk-serviceEjb.jar (ejb) ( My plattaform services )
                  --> fmk-entities.jar (PJO/persistence) ( My basic plattaform entities / persitence unit)

                  DC-EAR ( Application over my FMK platform)
                  --> dc.war ( seam 2.2 . Utilice dc-seam/fmk-seam )
                  --> dc-seam.jar (ejb) ( seam actions specific of dc )
                  ------> components.properties
                  ----------->ndiPattern=dc-ear/\#{ejbName}/local
                  --> dc-serviceEjb.jar (ejb) ( services of dc / call too fmk-serviceEjb )
                  ---> dc-entities.jar (pojo/persistence) extends BasicEntities of Fmk

                  --> fmk.war
                  --> fmk-seam.jar
                  ------> components.properties
                  ----------->ndiPattern=dc-ear/\#{ejbName}/local
                  --> fmk-serviceEjb.jar
                  --> fmk-entities.jar
                  META-INF
                  --> persistence.xml