Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3 JNDI lookup in WAS7

 
Viji San
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to invoke ejb3 beans in my struts2 action class in Websphere 7 server. As struts action is not a container managed component, I could not use DI to inject EJB3 beans. I 'm using the below JNDI lookup code in Websphere 7 server, but fails. Could anyone help me to provide JNDI EJB3 lookup URL/code for WAS7? What are the JNDI lookup methods available in WAS 7 for ejb3 and where could i find the documents please?. Thank you very much for helping me.



Exception:






 
Deepak Pant
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just change



to



and your JNDI lookup should work.

The other thing you can do is to look in the SystemOut.log for binding information for SampleEjbLocal. The log provides both short and long form JNDI bindings for all the objects that bind to the JNDI directory.

Let me know if this doesnt work
 
Viji San
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Deepak!!

The below lookup code worked, prefixed "ejblocal:" with the full qualified interface name. I found this in System.out log as you mentioned.

 
Rafiuddin Syed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting the below error while looking up EJB3.0 version bean, any suggestions?


[color=red]javax.naming.ConfigurationException: NamingManager.getURLContext cannot find the factory for this scheme[/color]






Thanks
Rafi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic