ejb@glassfish.java.net

Re: Need Help on EJB code generation

From: Mahesh.Kannan <Mahesh.Kannan_at_Sun.COM>
Date: Mon, 27 Nov 2006 02:55:09 -0800

Jason.Huang_at_Sun.COM wrote:

> Hi, All
>
> I have some questions about the implementation of EJB container.
>
> I have a Stateless bean in EJB2.x style which has a remote business
> method like:
> -----------------------------------------------------
>
> public String sayHi() {
> Thread.dumpStack();
> return "Foo";
> }
> -----------------------------------------------------
>
> I call the EJB from a standalone client, the output of the
> Thread.dumpStack(); is:
> ------------------------------------------------
> java.lang.Exception: Stack trace
> at java.lang.Thread.dumpStack(Thread.java:1158)
> at ejb.demo.helloworld2.HelloWorldBean.sayHi(HelloWorldBean.java:63)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1051)
>
> at
> com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
> at
> com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2812)
>
> at
> com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3896)
> at
> com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
>
> at
> com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:107)
>
> at $Proxy88.sayHi(Unknown Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(Unknown
> Source)
> at
> com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(Unknown
> Source)
> at
> com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(Unknown
> Source)
> at
> com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(Unknown
> Source)
> at
> com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(Unknown
> Source)
> ------------------------------------------------
> In the stack trace, I found class Proxy88 is called. However I cannot
> find the code which generate Proxy88.

This is an instance of JDK Proxy itself.

> I've read some codes in the package com.sun.ejb.codegen.
> According to my understanding, I assume that the WrapperGenerator
> will help generate the EJB Object implementation(XXXX_EJBObjectImpl),
> and this remote object will delegate the method to bean object itself.
> However I cannot find where the WrapperGenerator is used.
>
WrapperGenerators *were* used previously to generate implementation
classes for EJB 2.x impl classes.

> I found the input parameters for the rmic are the Remote and Remote
> Home interface, which can generate the stub classes. Where can I find
> the tie classes?

rmic -iiop generates both stub and tie classes. However, glassfish
doesn't use rmic anymore. It uses dynamic class generation techniques to
generate stub and tie classes.

The container now uses dynamic class generators to generate true IIOP
classes. For example, RemoteGenerator and Remote30WrapperGenerator are
now used by the container to dynamically generate the required iiop
classes dynamically.

 

> Coud you give some suggestions or documents on the EJB code generation?

There is nothing available yet (other than source code), but we will add
them soon to our docs.

--Mahesh

>
> Thanks & Best Regards,
> Jason
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>