title: JNDI lookup not working with EJB 3.x
body: <p>I'm using the following Bean class:</p>
  
  <pre><code>@Stateless(name="UserBean", mappedName="UserBean")
  @LocalBean
  public class User implements UserRemote {
  
  @PersistenceContext
  private EntityManager em;
  
  public User() {
  
  }
  
  public String login(String username, String password) {
  
      Query query = em.createQuery("...");
      return "xyz";
  }
  
  }
  </code></pre>
  
  <p>And my method is </p>
  
  <pre><code>public String myMethod()    {
  
      try {
          User user = (User) new InitialContext().lookup("UserBean");
          return "xyz";
      } catch (NamingException e) {
          e.printStackTrace();
      }
      return null;        
  }
  </code></pre>
  
  <p>Here I'm getting a </p>
  
  <pre><code>javax.naming.NameNotFoundException: Unable to resolve 'UserBean'. Resolved ''; remaining name 'UserBean'
  </code></pre>
  
  <p>The JNDI lookup name 'UserBean' seems to be correct. No idea what the problem is. Can anyone please help? I've deployed my application on weblogic 12c, using JPA 2.0 and EJB 3.x</p>
  
  <p>Thanks in advance.</p>