Nirav,

 

JNDI problems can be resolved by having a resource –ref  smething like :

 

----Begin------------

      <resource-ref>

                <ref-name>testbank</ref-name>

                <resource-link>testbank</resource-link>

     </resource-ref>

 

--End----------------

 

in ur code it shd be like -> ……

                                     ……ctx.lookup(“testbank”);

 

 

Thanks,

Santosh.

"Don't talk about yourself; it will be done when you leave. "

 

-----Original Message-----
From: Nirav Mehta [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 30, 2006 10:08 PM
To: [email protected]
Subject: Re: EJB trouble

 

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

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Reply via email to