geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Neubert <neuber...@t-online.de>
Subject Simple EJB isn't running
Date Mon, 05 Jun 2006 13:31:06 GMT
Hi !

Can anybody give me a hint where my fault is. I'm new to Geronimo, EJB 
and even J2EE, so it maybe a very stupid one.

I try to build and access an EJB and as a start I tried a simple session 
bean. I made it even simpler and now it's only a shadow of itself, but I 
cannot get it to run. (Initial EJB code is stolen from some EJB tutorial.)

(Deployment plans at mail end)

EJB and JNDI names are now all "ConverterEJB". Config-Id is 
"ConverterBeanJar". EJB jar deploys without error and is found in 
console as "ConverterBeanJar" (running) and also in the debug-tool as 
name="ConverterBeanJar" 
<http://localhost:8080/index.vm?ObjectNameFilter=*%3A*&MBeanName=geronimo.config%3Aname%3D%22ConverterBeanJar%22>

[running].

I try to access the bean from a client application (not from inside the 
AS, but a real stand-alone application).
I use the needed (J2EE, EJB, OpenEJB etc.) libraries from Geronimos 
repository directory.

Somewhere I found a code snippet to do this and at least sometimes (see 
below) the bean is found, but cannot instantiate on server side (as it 
seems to me). The code is:

    public static void main(String[] args)
    {
        try
        {
             Hashtable env = new Hashtable();
             
env.put("java.naming.factory.initial","org.openejb.client.RemoteInitialContextFactory");
             env.put("java.naming.provider.url", "127.0.0.1:4201");
             env.put("java.naming.security.principal", "system");
             env.put("java.naming.security.credentials", "manager");
             Context initial = new InitialContext(env);
             Object objref = (Context)initial.lookup("ConverterEJB");   
/* Here it breaks ... */
             ...

I changed the bean name and get different results

-    Started in Eclipse on jre1.5.0_02.
-    Compiled compliance level 1.4 and it's defaults - class files comp. 
1.2 / source compatibility 1.3.
-    Run with alternate JRE j2sdk1.4.2_11.

bean name = "ConverterEJB" (as in code above):
          ->   javax.naming.NamingException:
                    Cannot lookup /ConverterEJB [Root exception is 
java.rmi.RemoteException: Error reading response from server             
        (OEJP/2.0) : org/apache/geronimo/kernel/ClassLoading; nested 
exception is:
                       ...
                 Caused by: java.lang.NoClassDefFoundError: 
org/apache/geronimo/kernel/ClassLoading
                 at 
org.openejb.server.ejbd.EJBObjectInputStream.resolveClass(EJBObjectInputStream.java:80)
                       ...
         Output on server side:
                Booting Geronimo Kernel (in Java 1.4.2_11)...
                ...
                15:02:37,375 ERROR [JndiRequestHandler] Failed to write 
to JNDIResponse
                java.net.SocketException: Software caused connection 
abort: socket write error
                at java.net.SocketOutputStream.socketWrite0(Native Method)
                at 
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
                at 
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
                at 
java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1639)
                at 
java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1548)
                at 
java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1146)
                at 
java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1100)
                at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1241)
                at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
                at 
java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1355)
                at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:281)
                at 
org.openejb.client.EJBMetaDataImpl.writeExternal(EJBMetaDataImpl.java:186)
                at 
org.openejb.client.JNDIResponse.writeExternal(JNDIResponse.java:203)
                at 
org.openejb.server.ejbd.JndiRequestHandler.processRequest(JndiRequestHandler.java:125)
                at 
org.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:154)
                at 
org.openejb.server.ejbd.EjbServer.service(EjbServer.java:87)
                at 
org.openejb.server.ejbd.EjbServer$$FastClassByCGLIB$$d379d2ff.invoke(<generated>)
                at 
net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
                at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
                at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
                at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:800)
                at 
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
                at 
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
                at 
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
                at 
org.activeio.xnet.ServerService$$EnhancerByCGLIB$$932a3fdb.service(<generated>)
                at org.activeio.xnet.ServicePool$2.run(ServicePool.java:67)
                at org.activeio.xnet.ServicePool$3.run(ServicePool.java:90)
                at 
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:138)
                at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
                at java.lang.Thread.run(Thread.java:534)
                15:02:37,375 ERROR [EjbDaemon] 127.0.0.1 "JNDI_REQUEST 
OEJP/2.0" FAIL "Software
                    caused connection abort: socket write error"

bean name = "java:comp/env/ConverterEJB" (as given in geronimo and other 
documentation):
       ->   javax.naming.NameNotFoundException: 
/java:comp/env/ConverterEJB not found
                at 
org.openejb.client.JNDIContext.lookup(JNDIContext.java:257)
                at 
javax.naming.InitialContext.lookup(InitialContext.java:347)
                at 
de.fmjn.geronimo.converter.ConverterClient.main(ConverterClient.java:27)
         Output on server side:
                Booting Geronimo Kernel (in Java 1.4.2_11)...
                ...
        15:12:25,484 ERROR [ContainerIndex] contianerId is not a valid 
ObjectName: java:comp/env/ConverterEJB

=============================================================
EJB-jar.xml:
------------
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="2.1"
        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/ejb-jar_2_1.xsd">
       <description>A simple EJB from a tutorial</description>
       <display-name>ConverterBean</display-name>
       <enterprise-beans>
          <session>
             <description>This is the Converter EJB</description>
             <display-name>Converter-Enterprise-Bean</display-name>
             <ejb-name>ConverterEJB</ejb-name>
             <home>de.fmjn.geronimo.converter.ConverterHome</home>
             <remote>de.fmjn.geronimo.converter.Converter</remote>
             
<local-home>de.fmjn.geronimo.converter.ConverterLocalHome</local-home>
             <local>de.fmjn.geronimo.converter.ConverterLocal</local>
             
<ejb-class>de.fmjn.geronimo.converter.ConverterBean</ejb-class>        
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
          </session>
       </enterprise-beans>
       <assembly-descriptor>
          <method-permission>
             <unchecked />
             <method>
                <ejb-name>ConverterEJB</ejb-name>
                <method-name>*</method-name>
             </method>
          </method-permission>
          <container-transaction>
             ... (some transaction; I think they are irrelevant for this 
problem)
          </container-transaction>
       </assembly-descriptor>
    </ejb-jar>

OpenEJB-jar.xml:
------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <openejb-jar
        xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.0"
        xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.0"
        xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"
        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0"
        xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
        inverseClassloading="false"
        configId="ConverterBeanJar">
       <enterprise-beans>
          <session>
             <ejb-name>ConverterEJB</ejb-name>
             <jndi-name>ConverterEJB</jndi-name>
          </session>
       </enterprise-beans>
    </openejb-jar>




Mime
View raw message