Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Lookup from a servlet

 
mohdz Shalaby
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which is deployed on a webserver and I want to lookup a sesion bean fro it.
this is my code:


But this code throwing the following exception:

com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object.

I think I need to set the properties in the initial Context.
but how could I get the IIOP URI+PORT and how could I get the factory?
NOte: My directory Service is in WebSphere App Server.
 
Lave Kulshreshtha
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you made following entry in web.xml.

<ejb-ref>
<ejb-ref-name>ejb/CustomerNumbersHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>CustomerNumbersHome</home>
<remote>CustomerNumbers</remote>
</ejb-ref>

Above entry is an example only. The home and remote interfaces in entry above should be fully qualified classname for e.g. com.example.CustomerNumbersHome. In <ejb-ref-type> put the tyoe of your bean
session or entity.

Once you make an entry here, then application server will take care of every thing, please do not bother about IIOP URI+PORT etc..It is application server's responsibility.

Lave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic