This week's book giveaways are in the Angular and TypeScript and Web Services forums.
We're giving away four copies each of Programming with Types and The Design of Web APIs and have the authors on-line!
See this thread and this one for details.
Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

NameNotFoundException and jndi

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm having this error when trying to access a session bean:

[5/19/07 16:50:34:860 CST] 30379f6f Helpers W NMSV0605W: A Reference object looked up from the context "java:" with the name "comp/env/ejb/MyTest" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: java.lang.Object
Type: JndiLookupInfo
Content: JndiLookupInfo: jndiName="local:ejb/ejb/ejbs/MyTestHome"; providerURL=""; initialContextFactory=""

Exception data follows:
javax.naming.NameNotFoundException: Name ejb not found in context "local:".


what could be causing this??


Here's the entry in my ejb-jar.xml:

<ejb-jar id="ejb-jar_ID">
<display-name>EjbProj2</display-name>
<enterprise-beans>
<session id="MyTest">
<ejb-name>MyTest</ejb-name>
<home>ejbs.MyTestHome</home>
<remote>ejbs.MyTest</remote>
<local-home>ejbs.MyTestLocalHome</local-home>
<local>ejbs.MyTestLocal</local>
<ejb-class>ejbs.MyTestBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<ejb-client-jar>EjbProj2Client.jar</ejb-client-jar>
</ejb-jar>


Here's from my web.xml:

<ejb-local-ref id="EJBLocalRef_1179562165290">
<description></description>
<ejb-ref-name>ejb/MyTest</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>ejbs.MyTestLocalHome</local-home>
<local>ejbs.MyTestLocal</local>
<ejb-link>EjbProj2.jar#MyTest</ejb-link>
</ejb-local-ref>



Here's how i access the ejb from my code:

InitialContext context = new InitialContext();
obj = context.lookup("java:comp/env/ejb/MyTest");
MyTestLocal bean = ((MyTestLocalHome)obj).create();


Please help... thanks in advance!
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!