Skip to Content
author's profile photo Former Member
Former Member

NameNotFound Exception while accessing Stateless Session Bean

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.

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2004 at 04:52 AM

    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());

    %>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2004 at 10:45 AM

    Thanx Srinivas. Everything is working fine now.

    Regards,

    Sudhir Kumar Atluru

    Add comment
    10|10000 characters needed characters exceeded