This is actually a different problem -- it loaded the class successfully, but isn't looking in the right place for the EJB. I think your target-name should have at least a J2EEApplication component in it... perhaps something like: geronimo.server:J2EEApplication=null,J2EEModule=RemoteOperationEJB.jar,J2EEServer=geronimo,j2eeType=StatelessSessionBean,name=RemoteOperationEJB I'm not sure if that's totally correct -- to be sure, you could go to http://localhost:8080/debug-tool/ and search it for RemoteOperationEJB and see if you see a line like the above (assuming the JMX Debug web application is running). We should really have an easier way to refer to EJBs that were deployed separately. If the target-name above gives you trouble, you could try replacing the target-name with RemoteOperationEJB and see if we resolve that correctly, though I'm bo no means sure that we would (that is, that we would find the EJB in a standalone EJB JAR if you use ejb-link). Thanks, Aaron On 3/14/06, Bruno Custodio - Datacomp DSCB wrote: > Hi again, > > First thing, thanks for your reply! Anyway, i made the changes you said but the problem persists. Looks like the web app is able to lookup the EJB through JNDI but then cannot reference the classes. > > I built a sample JSP (see below), in which i now do the cast and not the narrow: > > <%@ page import="com.datacomp.am.ejb.RemoteOperationHome, > com.datacomp.am.ejb.RemoteOperation, > javax.naming.InitialContext, > javax.naming.Context"%> > > > EJB SAMPLE > > > <% String sJNDI = "java:comp/env/ejb/RemoteOperationEJB"; > Context initCtx = new InitialContext(); > RemoteOperationHome home = null; > try { > home = (RemoteOperationHome) initCtx.lookup(sJNDI); > } catch (Exception e) { > e.printStackTrace(); > } > %> >
CTX of <%= sJNDI %> > <% RemoteOperation oRemoteOper = home.create(); %> >
CREATE > > > > When i call it i have the following error in the home.create() statement: > > java.rmi.NoSuchObjectException: geronimo.server:J2EEServer=geronimo,j2eeType=StatelessSessionBean,name=RemoteOperationEJB > org.openejb.proxy.EJBMethodInterceptor.createEJBInvocation(EJBMethodInterceptor.java:171) > org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:115) > org.openejb.proxy.SessionEJBHome$$EnhancerByCGLIB$$345b112d.create() > org.apache.jsp.teste_jsp._jspService(org.apache.jsp.teste_jsp:80) > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > > In the servlet where i am still doing the narrow, the error is the same as in my first email...(produced in the actual narrow statement, the JNDI lookup passes through) > java.lang.NoClassDefFoundError > > The only change to the XML descriptors was in the geronimo-web.xml that now looks like: > > > xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.0" > configId="TestPunch"> > RemoteOperationEJB > > ejb/RemoteOperationEJB > geronimo.server:J2EEServer=geronimo,j2eeType=StatelessSessionBean,name=RemoteOperationEJB > > > > One doubt that i have, do i need to include in WEB-INF/lib a JAR including any of the EJB classes, or does the web app gets all from its classpath once it manages to see the EJB correctly? > > thanks again. > > Best regards, > Bruno > > ________________________________ > > De: ammulder@gmail.com em nome de Aaron Mulder > Enviada: ter 14-03-2006 14:01 > Para: user@geronimo.apache.org > Assunto: Re: Web App calling standalone EJB > > > > Try adding this to your geronimo-web.xml (above the ejb-ref): > > RemoteOperationEJB > > That should add the EJB clases to the classpath of the web app. (In > JBoss, it tends to put all apps on the same class loader, but Geronimo > doesn't work that way.) > > Also, a couple of less important notes: > > 1) You may want to remove the parentId from your openejb-jar.xml -- > it's not necessary to list the default one like you have, and it ties > you to Geronimo 1.0 since you have the "1.0" version string in there. > > 2) You don't actually need PortableRemoteObject.narrow unless you're > calling the remote EJB via CORBA, which you are not. A simple cast > will work. You won't be able to run this application under JDK 1.5 > with Geronimo 1.0 if you continue to use PRO.narrow > > Thanks, > Aaron > > On 3/14/06, Bruno Custodio - Datacomp DSCB wrote: > > > > Hi there, > > > > I've recently installed Geronimo v1.0. I am still adapting, as i was using > > JBOSS previously. > > > > In JBOSS i had a Web application (.war) and a separate EJB named > > RemoteOperationEJB.jar. From the web application i was doing the lookup of > > the EJB with no problems, creating the object and calling its methods. > > > > Now in Geronimo i'm having problems to replicate the same scenario. I was > > able to deploy the EJB and the WAR files separately but when i try to run > > the web application and call the EJB i'm having a "NoClassDefFound" > > exception in the narrow! > > > > First of all, is this possible to do in Geronimo, having a web app calling a > > EJB that are NOT part of a EAR? > > > > If so, then i mostly sure have an error in the XML descriptors. Below i put > > each of them: > > > > EJB-JAR.xml > > > > > > > JavaBeans 2.0//EN" > > "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> > > > > > > > > RemoteOperationEJB > > > > com.datacomp.am.ejb.RemoteOperationHome > > > > > > com.datacomp.am.ejb.RemoteOperation > > > > com.datacomp.am.ejb.RemoteOperationLocalHome > > > > com.datacomp.am.ejb.RemoteOperationLocal > > > > com.datacomp.am.ejb.RemoteOperationBean > > Stateless > > Container > > > > > > > > > > > > openejb-jar.xml > > > > > > > xmlns="http://www.openejb.org/xml/ns/openejb-jar" > > configId="RemoteOperationEJB" > > parentId="geronimo/j2ee-server/1.0/car"> > > > > > > RemoteOperationEJB > > ejb/RemoteOperationEJB > > > > > > > > > > web.xml > > > > > > > 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/web-app_2_4.xsd" > > version="2.4"> > > > > > > LoginServlet > > com.datacomp.tp.LoginServlet > > > > > > LoginServlet > > /LoginServlet > > > > > > 30 > > > > > > > > EJB Reference to the bean deployed to > > OpenEJB > > ejb/RemoteOperationEJB > > Session > > > > com.datacomp.am.ejb.RemoteOperationHome > > > > com.datacomp.am.ejb.RemoteOperation > > > > > > > > geronimo-web.xml > > > > > > > xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.0" > > xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.0" > > configId="TestPunch"> > > > > ejb/RemoteOperationEJB > > > > geronimo.server:J2EEModule=RemoteOperationEJB.jar,J2EEServer=geronimo,j2eeType=StatelessSessionBean,name=RemoteOperationEJB > > > > > > > > In my JAVA code i'm doing the following: > > > > //reference to the remote object > > Object objref = null; > > try { > > //get initial context and lookup EJB > > objref = > > ictx.lookup("java:comp/env/ejb/RemoteOperationEJB"); > > } catch (NamingException e) { > > //some problem looking up the remote object > > e.printStackTrace(); > > return null; > > } > > RemoteOperationHome home = (RemoteOperationHome) > > PortableRemoteObject.narrow(objref, RemoteOperationHome.class); > > try { > > return home.create(); > > } catch (javax.ejb.CreateException ec) { > > ec.printStackTrace(); > > } catch (RemoteException re) { > > re.printStackTrace(); > > } > > return null; > > } > > > > And it gives that exception in the narrow command! > > > > > > any possible help is welcome! > > > > thanks in advance, > > > > best regards, > > Bruno Custódio > > > > > > > >