geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Rink <kr...@pm-planc.de>
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:

<code>
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;

}
</code>




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

<code>
   String output = "";

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

        System.err.println("Naming exception occurred during
initialization"+ e);
           e.printStackTrace();
   }
</code>




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

<error>
Naming exception occurred during
initializationjavax.naming.NameNotFoundException: env/ejb/Simple
javax.naming.NameNotFoundException: env/ejb/Simple
	at
org.apache.geronimo.naming.enc.AbstractReadOnlyContext.lookup(AbstractReadOnlyContext.java:81)
	at org.apache.geronimo.naming.java.RootContext.lookup(RootContext.java:51)
	at javax.naming.InitialContext.lookup(InitialContext.java:347)
	at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:76)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
</error>



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...
Kris



-- 
Kristian Rink   -- Programmierung/Systembetreuung
planConnect GmbH * Strehlener Str. 12 - 14 * 01069 Dresden
0176 24472771 * krink@pm-planc.de

Mime
View raw message