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:[email protected]>
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();
}
}