• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI name lookup problem in session bean

 
Sugantha Jeevankumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Devaka Cooray
Marshal
Posts: 5174
490
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!