This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
jQuery in Action, 2nd edition
 
subject: EJB Lookup from a servlet
 
Similar Threads
java.lang.ClassCastException when assigning to home interface?
EJB and my servlet
no security manager: RMI class loader disabled
EJB client for Websphere throws ClassCastException
Problem in getting EJBHome for stateless session bean in servlet in websphere4.0