geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: javax.naming.NameNotFound exception
Date Sun, 14 Aug 2005 18:09:59 GMT
The simplest solution is to package your 2 modules in an ear file.  
Otherwise you will have to include a geronimo-web.xml with an ejb-ref 
that indicates that the ejb is in your ejb module.  We only try to 
auto-resolve ejb references within the current application.

If you wish to continue with separate modules I think something like 
this is necessary:

<ejb-ref>
   <ref-name>prueba/MyTestSessionBean</ref-name>
   <module> EjemploEJB</module>
   <name> MyTestSession<name>
</ejb-ref>

I wrote this from memory so there may be numerous mistakes.

Also, you need to look up "java:comp/env/prueba/MyTestSessionBean" and 
you should remove the jndi-name element: it is used only for lookup in 
standalone clients and in corba.

Hope this helps
david jencks

On Aug 14, 2005, at 10:44 AM, IƱigo wrote:

> Hello again!
>    Today I am trying to deploy a different application. I have a 
> simple HTML page with a link to a Servlet that calls a Stateless EJB. 
> With ant I have created the jar file for the EJB module, and the war 
> one for the web module. Now, when I deploy the EJB module Geronimo 
> deploys it right, but when I try to deploy the war, I get a 
> NameNotFoundException when the Servlet does the lookup for the ejb, 
> well I am using the same jndi-name I have specified in 
> openejb-jar.xml, the parentId for the war module is the jar module. 
> The full trace in the server is:
>
> Geronimo Application Server started (version 1.0-M4)
> javax.naming.NameNotFoundException: prueba
>        at 
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java
> :90)
>        at 
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java
> :98)
>        at javax.naming.InitialContext.lookup(InitialContext.java:347)
>        at 
> prueba.session.SessionTestServlet.init(SessionTestServlet.java:28)
>        at 
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.jav
> a:383)
>        at 
> org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:243)
>
>        at 
> org.apache.geronimo.jetty.JettyWebAppContext.registerServletHolder(Je
> ttyWebAppContext.java:475)
>        at 
> org.apache.geronimo.jetty.JettyWebAppContext$$FastClassByCGLIB$$99d6f
> b54.invoke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at 
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethod
> Invoker.java:38)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperatio
> n.java:118)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.
> java:719)
>        at 
> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:5
> 7)
>        at 
> org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperat
> ionInvoker.java:36)
>        at 
> org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(Pro
> xyMethodInterceptor.java:94)
>        at 
> org.apache.geronimo.jetty.JettyServletRegistration$$EnhancerByCGLIB$$
> 48e704ed.registerServletHolder(<generated>)
>        at 
> org.apache.geronimo.jetty.JettyServletHolder.<init>(JettyServletHolde
> r.java:71)
>        at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>
>        at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
> orAccessorImpl.java:39)
>        at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
> onstructorAccessorImpl.java:27)
>        at 
> java.lang.reflect.Constructor.newInstance(Constructor.java:274)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanI
> nstance.java:815)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart
> (GBeanInstanceState.java:328)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInsta
> nceState.java:111)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(G
> BeanInstanceState.java:133)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanI
> nstance.java:503)
>        at 
> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(Basi
> cKernel.java:205)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(G
> BeanInstanceState.java:141)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanI
> nstance.java:503)
>        at 
> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(Basi
> cKernel.java:205)
>        at 
> org.apache.geronimo.kernel.KernelGBean.startRecursiveGBean(KernelGBea
> n.java:72)
>        at 
> org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.in
> voke(<generated>)
>        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>        at 
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethod
> Invoker.java:38)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperatio
> n.java:118)
>        at 
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.
> java:754)
>        at 
> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:
> 175)
>        at 
> org.apache.geronimo.kernel.jmx.MBeanServerDelegate.invoke(MBeanServer
> Delegate.java:117)
>        at 
> mx4j.remote.rmi.RMIConnectionInvoker.invoke(RMIConnectionInvoker.java
> :219)
>        at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
>        at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:324)
>        at 
> mx4j.remote.rmi.RMIConnectionProxy.invoke(RMIConnectionProxy.java:34)
>
>        at 
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.chain(RMIConnectionSubjec
> tInvoker.java:99)
>        at 
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.access$000(RMIConnectionS
> ubjectInvoker.java:31)
>        at 
> mx4j.remote.rmi.RMIConnectionSubjectInvoker$1.run(RMIConnectionSubjec
> tInvoker.java:90)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
>        at 
> mx4j.remote.MX4JRemoteUtils.subjectInvoke(MX4JRemoteUtils.java:163)
>        at 
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.subjectInvoke(RMIConnecti
> onSubjectInvoker.java:86)
>        at 
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.invoke(RMIConnectionSubje
> ctInvoker.java:80)
>        at $Proxy0.invoke(Unknown Source)
>        at 
> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImp
> l.java:221)
>        at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
>        at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:324)
>        at 
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>        at sun.rmi.transport.Transport$1.run(Transport.java:148)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>        at 
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
> 60)
>        at 
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
> .java:701)
>        at java.lang.Thread.run(Thread.java:534)
>
> <cid:part1.05050802.04010105@nodo50.org>
> The full openejb-jar.xml is this:
> <?xml version="1.0"?>
> <openejb-jar
>    xmlns="http://www.openejb.org/xml/ns/openejb-jar"
>    configId="EjemploEJB"
>    parentId="org/apache/geronimo/Server">
>    <enterprise-beans>
>        <session>
>            <ejb-name>MyTestSession</ejb-name>
>            <jndi-name>prueba/MyTestSessionBean</jndi-name>
>        </session>
>    </enterprise-beans>
> </openejb-jar>
>
> And this is the init method in the Servlet:
> public void init(ServletConfig config) throws ServletException{
>    //Look up home interface
>    try {
>        InitialContext ctx = new InitialContext();
>        Object objref = ctx.lookup("prueba/MyTestSessionBean");
>        testSessionBean = 
> (MyTestSessionHome)PortableRemoteObject.narrow(objref,    
> MyTestSessionHome.class);
>    }
>    catch (Exception NamingException) {
>        NamingException.printStackTrace();
>    }
>    }
>


Mime
View raw message