0 Replies Latest reply on Jan 3, 2002 9:11 PM by Adam Young

    Naming scheme for deploying bean multiple times

    Adam Young Newbie

      Suppose you want to have two applications which use the same set of EJBs, but against different databases. TO simplify, assume only session beans call entity beans. Currently, for the AgentListBean to get a reference to AgentListHome, I use:

      InitialContext jndiContext = new InitialContext();Object ref = jndiContext.lookup(jndiName);
      return (EJBHome) PortableRemoteObject.narrow(ref, homeClass);

      where the jndiName = "getcare/Agent"

      I'd like to modify my code so that
      jndiName = getJarName() + "/" + EBJ_NAME;

      The problem I have is the getJarName(). I know I can add the following code to each EJB in the ejb-jar.xml:

      <env-entry>
      <env-entry-name>namespace</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>jarname</env-entry-value> </env-entry>

      And then run a script which replaces jarname with the value I want to use. There has to be a better way. Is there something in jboss.xml or jaws.xml that I can use?