Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes EJB Lookup from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB Lookup from a servlet" Watch "EJB Lookup from a servlet" New topic
Author

EJB Lookup from a servlet

mohdz Shalaby
Greenhorn

Joined: Jan 17, 2008
Posts: 1
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

Joined: Oct 21, 2007
Posts: 106
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


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, ITIL V3 Foundation Certification
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Lookup from a servlet