geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Isuru Samaraweera <isurunishan2...@yahoo.com>
Subject Re: Locally Reffered EJB by Servlet Problem
Date Mon, 10 Jul 2006 17:00:09 GMT
Hi Lasantha,
   Make sure you have following entries in geronimo-web.xml file. 
    <ejb-local-ref>
  <ref-name>ejb/HelloLocal</ref-name>
  .....   
    </ejb-local-ref>

  Regards,
Isuru
lasantha@opensource.lk wrote:
  Hi All,

I have been writing a sample EAR application to the Geronimo 1.1. This
sample application is basically HelloWorld application, which contains a
stateless session bean reffered by a servlet as in the follows.

System.out.println("### Request Recieved ###");

Context context = new InitialContext();
HelloHome home = (HelloHome)context.lookup("java:comp/env/ejb/HelloLocal");
Hello hello = home.create();
hello.sayHello();

It gives following error in the console.
### Request Recieved ###
javax.naming.NameNotFoundException: env/ejb/HelloLocal
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:351)
at com.test.web.HelloServlet.sayHello(Unknown Source)
at com.test.web.HelloServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
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.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:46)
at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:342)
at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:31)
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:541)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
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)


It looks EJB is not visible to the Servlet. How can I overcome this
problem? Herewith I have attached the configuration files used to create
the EAR.

Thanks,

Lasantha Ranaweera
Senior Software Engineer,
Lanka Software Foundation,
Sri Lanka.
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">

Hello.jar



Hello.war
/Hello








Generated by XDoclet







HelloBean

com.test.ejb.HelloHome
com.test.ejb.Hello
com.test.ejb.HelloBean
Stateless
Container



       To add session beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called session-beans.xml that contains
       the  markup for those beans.
     -->


       To add entity beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called entity-beans.xml that contains
       the  markup for those beans.
     -->


       To add message driven beans that you have deployment descriptor info for, add
       a file to your XDoclet merge directory called message-driven-beans.xml that contains
       the  markup for those beans.
     -->






       To specify your own assembly descriptor info here, add a file to your
       XDoclet merge directory called assembly-descriptor.xml that contains
       the  markup.
     -->


       To specify additional security-role elements, add a file in the merge
       directory called ejb-security-roles.xml that contains them.
     -->


       To specify additional method-permission elements, add a file in the merge
       directory called ejb-method-permissions.ent that contains them.
     -->





HelloBean
*




       To specify additional container-transaction elements, add a file in the merge
       directory called ejb-container-transactions.ent that contains them.
     -->




       To specify additional message-destination elements, add a file in the merge
       directory called ejb-message-destinations.ent that contains them.
     -->


       To specify an exclude-list element, add a file in the merge directory
       called ejb-exclude-list.xml that contains it.
     -->





default
HelloEAR
1.0
car










default
HelloEJB
1.0
car







HelloBean 
java:comp/env/ejb/HelloLocal




 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail Beta.
Mime
View raw message