2 Replies Latest reply on Mar 29, 2006 8:53 AM by oglueck

    Lookup on SessionContext

    alex1234567890

      Hi,

      is it possible to make a lookup on a SessionContext on a session bean?

      I have the following stateless session bean:

      Interface:
      public interface IAttributeService
      
      Implementation:
      @Stateless
      @Local( { IAttributeService.class })
      @LocalBinding( jndiBinding = "IAttributeService-local" )
      public class AttributeServiceImpl implements IAttributeService
      



      Via the JNDIView On the JMX-console i get the following mapping:

      IAttributeService-local
      $Proxy147

      I tried to make a lookup from another session bean:

      @Resource
      private SessionContext fContext;
      ...
      IAttributeService attService = (IAttributeService) fContext.lookup( "IAttributeService-local" );
      


      But always null is returned.
      On jboss-4.0.3RC2 (EJB_3.0_RC1) it worked fine but now on jboss-4.0.4RC1 (EJB_3.0_RC5) it doesnt work anymore.

      So must i use the InitialContext?

      InitialContext ctx = new InitialContext();
      IAttributeService attService = (IAttributeService) ctx.lookup("IAttributeService-local");
      

      If I use the initial context I get the AttributeService.

      Why its not possible to make a lookup via the SessionContext?