geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Rink <>
Subject Re: ejb NameNotFound exception?
Date Wed, 08 Mar 2006 08:43:57 GMT

Hi Sachin, world;

and, at first, thanks for the patience and all the hints...

Sachin Patel schrieb:
> I just cracked open the war, and it was still using the util class.  If
> you change the servlet code to not use the util class and do the lookup
> yourself using COMP_NAME it should work.

Actually, at the moment I'm close to desperation about this. I started
over with a new project to leave out everything not absolutely required,
created a simple bean and a simple JSP supposed to invoke the bean.

The EJB home interface looks like this:

public interface SimpleHome
   extends javax.ejb.EJBHome
   public static final String COMP_NAME="java:comp/env/ejb/Simple";
   public static final String JNDI_NAME="Simple";

   public ejbs.Simple create()
      throws javax.ejb.CreateException,java.rmi.RemoteException;


The JSP contains the following code supposed to invoke the bean and get
some business method called:

   String output = "";

   try {
        javax.naming.InitialContext ctx = new javax.naming.InitialContext();
        Object obj = ctx.lookup(SimpleHome.COMP_NAME);
        SimpleHome home =
        Simple s = home.create();
        output = s.getDate();
   } catch (NamingException e){

        System.err.println("Naming exception occurred during
initialization"+ e);

Again, it deploys well, seems tu run, but accessing the web context once
again ends up in a NameNotFound exception to be thrown:

Naming exception occurred during
initializationjavax.naming.NameNotFoundException: env/ejb/Simple
javax.naming.NameNotFoundException: env/ejb/Simple
	at javax.naming.InitialContext.lookup(
	at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:76)
	at org.apache.jasper.runtime.HttpJspBase.service(
	at javax.servlet.http.HttpServlet.service(

Is there anything else I should be aware of while getting this to work?
I'm left pretty clueless about that, by now... :(

TIA and bye, have a nice day...

Kristian Rink   -- Programmierung/Systembetreuung
planConnect GmbH * Strehlener Str. 12 - 14 * 01069 Dresden
0176 24472771 *

View raw message