cancel
Showing results for 
Search instead for 
Did you mean: 

NameNotFound Exception while accessing Stateless Session Bean

Former Member
0 Kudos

Hi,

I have deloyed 20 beans. One of them is Statefull and others are stateless. I am able to see in Administrative console that all the beans are deployed.

I am able to get lookup for the statefull bean from a JSP but unable to get the lookup for stateless beans. My code is a follows.

Context ctx = new InitialContext();

Object obj = ctx.lookUp("<- Bean Name ->");

This gives me a name not found exception when I try to lookup for a stateless bean. Any help will be appreciated.

Regards

Sudhir.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanx Srinivas. Everything is working fine now.

Regards,

Sudhir Kumar Atluru

Former Member
0 Kudos

Hi Sudhir,

If the deployement was successful there should be no problem in lookup.

This is a simple jsp code i have to perform lookup on stateless session bean hope it helps you.

<%@ page language="java" import="java.util.,java.io.,com.tetrapak.ejb.,javax.naming.,java.rmi.,javax.ejb.,javax.rmi.*;"%>

<%

Properties env = new Properties();

env.setProperty("java.naming.factory.initial","com.inqmy.services.jndi.InitialContextFactoryImpl");

env.setProperty("java.naming.provider.url","<host>:50004");

InitialContext context = new InitialContext(env);

Object obj=context.lookup("UserBean");

System.out.println("After lookup: " + obj);

UserHome home =(UserHome)PortableRemoteObject.narrow(obj,UserHome.class);

UserRemote hello = home.create();

out.println("Bean message: " + hello.hello());

%>