File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes javax.naming.NameNotFoundException: While trying to lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "javax.naming.NameNotFoundException: While trying to lookup" Watch "javax.naming.NameNotFoundException: While trying to lookup" New topic
Author

javax.naming.NameNotFoundException: While trying to lookup

Dave Robinson
Greenhorn

Joined: May 11, 2005
Posts: 4
I am writing a test client for my ejb and I am getting an exception while trying to do a lookup. I am thinking that my ejb-jar.xml or weblogic-ejb-jar.xml is not configured properly or my value I am passing for the lookup is not correct.



javax.naming.NameNotFoundException: While trying to lookup 'demo.DemoHome' didn't find subcontext 'demo'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'demo.DemoHome' didn't find subcontext 'demo'. Resolved '']; remaining name 'demo/DemoHome'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at weblogic.jndi.internal.ServerNamingNode_1032_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:405)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ejb.demo.DemoClient.main(DemoClient.java:35)
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'demo.DemoHome' didn't find subcontext 'demo'. Resolved ''
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)

ejb-jar.xml

<ejb-jar id="ejb-jar_ID">
<display-name>demo</display-name>
<enterprise-beans>
<session>
<ejb-name>DemoBean</ejb-name>
<home>ejb.demo.DemoHome</home>
<remote>ejb.demo.Demo</remote>
<ejb-class>ejb.demo.DemoBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<ejb-client-jar>DemoClient.jar</ejb-client-jar>
</ejb-jar>


weblogic-ejb-jar.xml

<wls:weblogic-ejb-jar xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">
<wls:weblogic-enterprise-bean>
<wls:ejb-name>DemoBean</wls:ejb-name>
<wls:stateless-session-descriptor></wls:stateless-session-descriptor>
<wls:jndi-name>ejb.demo.Demo.DemoBean</wls:jndi-name>
</wls:weblogic-enterprise-bean>
</wls:weblogic-ejb-jar>

Someone please advise
Meiyappan Kannappa
Greenhorn

Joined: Sep 15, 2008
Posts: 10
Hi

I hope the JNDI name in the Deployment descriptor(ejb.demo.Demo.DemoBean) and the one you are trying to lookup are different (Demo.DemoBean). Try with full JNDI name. Since i am not very sure of weblogic. Since in JBoss it requires full JNDI name.


Warm Regards
 
 
subject: javax.naming.NameNotFoundException: While trying to lookup
 
Similar Threads
New to EJB
Correct way of ejb-link
JNDI Name not found exception
NameNotFoundException: 'ordermanagementLocal'
XPost: How to specify a simple JNDI name for my EJB in WebLogic 10 (with annotations)?