Note that there are some explanatory texts on larger screens.

plurals
  1. POejb lookup failing with NamingException
    primarykey
    data
    text
    <p>I've added the following in my web.xml:</p> <pre><code>&lt;ejb-ref&gt; &lt;ejb-ref-name&gt;ejb/userManagerBean&lt;/ejb-ref-name&gt; &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt; &lt;home&gt;gha.ywk.name.entry.ejb.usermanager.UserManagerHome&lt;/home&gt; &lt;remote&gt;what should go here??&lt;/remote&gt; &lt;/ejb-ref&gt; </code></pre> <p>The following java code is giving me NamingException:</p> <pre><code>public UserManager getUserManager () throws HUDException { String ROLE_JNDI_NAME = "ejb/userManagerBean"; try { Properties props = System.getProperties(); Context ctx = new InitialContext(props); UserManagerHome userHome = (UserManagerHome) ctx.lookup(ROLE_JNDI_NAME); UserManager userManager = userHome.create(); WASSSecurity user = userManager.getUserProfile("user101", null); return userManager; } catch (NamingException e) { log.error("Error Occured while getting EJB UserManager" + e); return null; } catch (RemoteException ex) { log.error("Error Occured while getting EJB UserManager" + ex); return null; } catch (CreateException ex) { log.error("Error Occured while getting EJB UserManager" + ex); return null; } } </code></pre> <p>The code is used inside the container. By that I mean that the .WAR is deployed on the server (Sun Application Server). </p> <p>StackTrace (after jsight's suggestion):</p> <pre><code>&gt;Exception occurred in target VM: com.sun.enterprise.naming.java.javaURLContext.&lt;init&gt;(Ljava/util/Hashtable;Lcom/sun/enterprise/naming/NamingManagerImpl;)V java.lang.NoSuchMethodError: com.sun.enterprise.naming.java.javaURLContext.&lt;init&gt;(Ljava/util/Hashtable;Lcom/sun/enterprise/naming/NamingManagerImpl;)V at com.sun.enterprise.naming.java.javaURLContextFactory.getObjectInstance(javaURLContextFactory.java:32) at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:584) at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:533) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:279) at javax.naming.InitialContext.lookup(InitialContext.java:351) at gov.hud.pih.eiv.web.EjbClient.EjbClient.getUserManager(EjbClient.java:34) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload