title: jndi binding for local and remote stateless bean
body: <p>I'm trying to implements an EJB3 stateless with a remote and local interfaces the problem is the local one is called in an other remote EJB with the annotation <code>@EJB</code> but it returns null or <code>ClassCastException</code> (<code>java.lang.ClassCastException: com.sun.proxy.$Proxy58 cannot be cast</code>).</p>
  
  <p>To perform the lookup on the server to get the local stateless I have to put 2 JNDI names for the stateless else it gives me the remote one.</p>
  
  <pre><code>@Stateless(mappedName=IRemoteInterface.JNDI_NAME, description="...")
  @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
  @Interceptors({GenericInvocationHandler.class})
  @Remote(IRemoteInterface.class)
  @Local(ILocalInterface.class)
  public class MystatelessBean extends AbstractBasicBean implements 
      IRemoteInterface, ILocalInterface {
     ...
  }
  
  @Stateless(mappedName=IRouting.JNDI_NAME, description="gives access to other services")
  @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
  @Interceptors({GenericInvocationHandler.class})
  @Remote(IRouting.class)
  public class RoutingServiceBean extends AbstractBasicBean implements IRouting {
  
      @EJB
      public ILocalInterface iLocalInterface;
  
  }
  </code></pre>
  
  <p>Actually, when I use <code>@EJB</code> I get <code>NPE</code> and when I use <code>@EJB(beanName=IRemoteInterface.JNDI_NAME)</code> I get <code>ClassCastException</code> which is right JNDI name of the remote interface.</p>
  
  <p>I m looking for something like <code>@LocalBinding</code> and <code>@RemoteBinding</code> in JBoss.</p>
  
  <p>Maybe I'm missing something?</p>