I am attempting to run a servlet with the following init function:
public void init() throws ServletException
{
try
{
// Get a naming context
InitialContext jndiContext = new InitialContext();
// Get a reference to the Dean Bean
Object ref = jndiContext.lookup("java:comp/env/ejb/Dean");
// Get a reference from this to the Bean's Home interface
deanHome = (DeanHome) PortableRemoteObject.narrow(ref, DeanHome.class);
}
catch(Exception e)
{
throw new ServletException("Failed to lookup java:comp/env/ejb/Dean", e);
}
}
Unfortunately the exception is being thrown. I am new to this and would like to know if there are any (obvious) errors with this code...
thanks
Did you remember to add the <ejb-ref> for the private lookup you're using (ejb/Dean) ?