Note that there are some explanatory texts on larger screens.

plurals
  1. POproblem with JNDI
    primarykey
    data
    text
    <p>I have code which uses JNDI.The code snippet as as follows:</p> <pre><code>EntityManager createEM(String JNDI ){ EntityManager em = null; try{ InitialContext ic = new InitialContext(); em = (EntityManager) ic.lookup(JNDI); return em; } catch (Exception ex){ LOG.Error("error in creating em"); ex.printStackTrace(); } } </code></pre> <p>Now i get error .The control enters catch block.</p> <pre><code>javax.naming.NameNotFoundException: Name comp/env/persistence not found in context "java:". [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:394) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154) [12/28/10 15:51:07:086 GMT+05:30] 00000081 SystemErr R at javax.naming.InitialContext.lookup(Unknown Source) </code></pre> <p>I have 2 projects say A and B.Now project B has the above method and from project A i am calling mehod from project B.persistent.xml is presnt only in project A.Do i need to place persistent.xml in project A too?I also get the folloing as a part of exception</p> <pre><code> javax.naming.NameNotFoundException: Name comp/env/persistence not found in context "java:". </code></pre> <p>What may be the cause.Am using websphere.</p>
    singulars
    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.
    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