0 Replies Latest reply on Feb 5, 2002 7:03 PM by Guy Rouillier

    Using NamingAlias to redirect to remote EJB

    Guy Rouillier Newbie

      Thought others may benefit from my figuring out how to do this. I had EJB A invoking EJB B. They both started out located on the same EJB instance, so EJB A just does

      new InitialContext().lookup("java:comp/env/ejb/mycompany/B")

      Now, a late-arriving requirement is to move B onto a different server. I want to minimize source code changes. I originally modified the deployment descriptor jboss.xml; that worked, but wanted something even simpler so I wouldn't have to rebuild the jar, since we use shell scripts to move from our test environment to our prod environment, and I don't want to be ripping the jars apart to that.

      So next I looked at using ExternalContext, but that appears to only allow hooking up the root of a remote NamingContext. Finally, I searched these forums and found NamingAlias. This worked!


      jnp://remote-server:1099/com/mycompany/ejb/B
      com/mycompany/ejb/B


      This is perfect for us, since we only have to change the jboss.jcml file on each platform, which is custom anyway. And the neat thing is that the FromName is only a partial name; the full EJB name is com/mycompany/ejb/A/A. Am I correct in believing that NamingAlias is JBoss-specific?