This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JNDI name lookup problem in session bean

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been trying a sample EJB code in the OC4J server using Jdeveloper, but I get an error at the stage of JNDI lookup... Dont know if I am specifying the jndi-name tag in a place where the server is able to read it... My code is as follows

The orion-ejb-jar.xml...


And I am performing the client lookup as follows,



The error I get is...

javax.naming.NameNotFoundException: ejb1 not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:57)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at project2.SessionEJBClient.main(SessionEJBClient.java:19)

Any pointers and suggestions are most welcome... Thanks in Advance.
 
Sugantha Jeevankumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok... I get some part of it now... When I use a standalone java client accessing an EJB, I am not supposed to use the RMIInitialContextFactory. I also read in the Jdeveloper forums that the initialization of the appropriate 'initial context' is handled by Jdeveloper, when I use the "Create Java Client For EJB" option.

So, I use the default constructor of InitialContext and let the IDE handle the initialization
My code is as follows...



Still I get the same error during lookup. Please suggest if I have to configure the JNDI name in any place other than the orion-ejb-jar.xml deployment descriptor.... Any help is much appreciated.
 
Sheriff
Posts: 6871
1312
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sugantha,

Well, I'm not sure about the orion-ejb-jar xml snippets. But in a generic ejb-jar.xml descriptor, the session bean configuration should be done as below:

Are you using EJB 3.0? Then I think that it is better if you can use annotations instead of coding 'everything' in these XML based descriptors.

Cheers,

Devaka.
 
reply
    Bookmark Topic Watch Topic
  • New Topic