1 Reply Latest reply on Aug 31, 2007 12:08 PM by wayne baylor

    Naming for a stateles in an EAR

    J-C jc Apprentice

      I have an interface. with several implentation developped as stateless session.
      In a session bean according to an algorithm I choose one of the implementation. Each implementation as a name and is deployed in the same ear as the invoker

      my code looks like:

      @Resource SessionContext ctx;
      public void myMethod() {
      if (...) {
      } else if (...) {
      } ...

      This code works fine but I have to hardcode the name of the ear. In my project the name of the ear contain the project version. I'd like to be able to do a lookup with adding the earname. My ejb always uses implemtnations contains in the same ear.

      1-Is it possible to invoke a service in the same ear without writting the ear name in the lookup ?
      2-Is it possible to dynamiclly get the ear name from a staeless session ?

      I do not want to use the EJB annotation in order not to inject ejb that I will not use. Is there other solution ?