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 a comment
10|10000 characters needed characters exceeded

Related questions

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 a 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.