• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

javax.naming.NameNotFoundException: While trying to lookup

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic