5 Replies Latest reply on May 6, 2003 4:46 PM by Juha Lindfors

    JNDI and versioning

    pants Newbie

      I'm trying to deploy two versions of same EJB side by side but they are conflicting because they both register the same JNDI name.

      (They both have their own "loader-repository" so theres no duplicate class problems, just duplicate JNDI name problems)

      I'm thinking of just putting a version number in the JNDI name. Is this a common way of solving this problem?

        • 1. Re: JNDI and versioning
          Raja Master

          The JNDI Names are on a server level. You MUST have different names for the ejbs if u are deploying them to the same server.

          -Raj

          • 2. Re: JNDI and versioning
            pants Newbie

            Yeah I realise that, what I was wondering was if applying version numbers to JNDI names was common/good practice.

            So the JNDI name for an EJB...

            /some/path/to/my/EJB

            becomes

            /some/path/to/my/EJB.1
            /some/path/to/my/EJB.2
            /some/path/to/my/EJB.3
            etc...

            Any comments/suggestions?

            • 3. Re: JNDI and versioning
              Jon Barnett Master

              It is not a very common thing to do - at least not with complex applications with many components. Apart from having to change descriptors and references in other components calling your service, it becomes a bit of a maintenance nightmare working out what broke, what version you were calling and the rest.

              However, there are cases where it might be useful but I'm having trouble picturing it. ;)

              • 4. Re: JNDI and versioning
                Raja Master

                Actually what we do here in my project is let Ant take care of that mess.
                We have an XML template which has a reference tag(for e.g. @type@) embedded in the XML
                When we build it, we copy it to another XML and use the ant replace to replace all @type@ to say "ver1" . so all my jndi names become
                com.blah.blah.ejb1.ver1
                com.blah.blah.ejb2.ver1

                and whenver we go to another deployment for another app, just change ver1 to ver2 and ant takes care of building it.


                • 5. Re: JNDI and versioning
                  Juha Lindfors Master

                  I use different subcontexts myself, rather than change the name the object is bound under -- but I guess the difference is minimal.