geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nirav Mehta" <mehtani...@gmail.com>
Subject Re: EJB trouble
Date Tue, 30 May 2006 16:38:13 GMT
>
> One of the problems is that you have an  ejb-local-ref from the web app to
> the ejb.  This can only be deployed if the web app and ejb app are in the
> same ear.
>

Thanks david....this is learning for me. I removed the local ref, but now I
think there is something wrong with my code. This is how I am accessing my
bean:

    <%
        helloWorld.HelloWorld helloBean = null;
        try {
            javax.naming.Context ctx = new javax.naming.InitialContext();
            helloWorld.HelloWorldHome helloHome = (helloWorld.HelloWorldHome)
ctx.lookup(helloWorld.HelloWorldHome.JNDI_NAME);
            helloBean = helloHome.create();
            request.getSession(true).setAttribute("HelloBean", helloBean);
    %>
        The Bean says :    <%=helloBean.sayHello()%>
    <%
        } catch (Exception e) {
    %>
        Error :    <br>
        <% e.printStackTrace(response.getWriter()); %>
    <%
        }
    %>


This is the stack trace:

javax.naming.NameNotFoundException: HelloWorld at
com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:95) at
com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:103)
at javax.naming.InitialContext.lookup(InitialContext.java:351) at
org.apache.jsp.Hello_jsp._jspService(org.apache.jsp.Hello_jsp:55) at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:688) at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:688) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:173) at
org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213) at
org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178) at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(
GeronimoStandardContext.java:272) at
org.apache.geronimo.tomcat.valve.TransactionContextValve.invoke(
TransactionContextValve.java:53) at
org.apache.geronimo.tomcat.valve.ComponentContextValve.invoke(
ComponentContextValve.java:47) at
org.apache.geronimo.tomcat.valve.InstanceContextValve.invoke(
InstanceContextValve.java:60) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107) at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
(Http11Protocol.java:744) at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527) at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80) at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)


I think there should be some more involved in finding the bean in the
JNDI....or is there something required in the bean code to register it? I am
not familiar with the concept of JNDI. Can someone suggest where I can learn
how to lookup EJBs from?

Thanks in advance for your patience :)

Regards,
Nirav

Mime
View raw message