geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ying Tang <yingtang1...@gmail.com>
Subject Re: Basic EJB app structure
Date Wed, 01 Apr 2009 06:56:46 GMT
I have successfully run this example using Eclipse 3.4.1 and Geronimo 2.1.3,
and only the CalcServlet  code was a bit differnent:

----------------------------------------------------------
@EJB(name = "ejb/CalculatorRemote")
    private CalculatorRemote  calculator;
-----------------------------------------------------------

And I didn't package EJB and Web as a EAR, but added the EJB project to the
build path of Web project, and use "Add and Remove Projects" in Eclipse
plugin.

Hope this page gives you some hint:
http://cwiki.apache.org/GMOxDOC21/web-application-for-ejb-access.html


Best  Regards,
Ying Tang

2009/4/1 David Jencks <david_jencks@yahoo.com>

> It looks like the critical bit of stack trace is this:
>
> Caused by: java.io.NotSerializableException:
> org.apache.openejb.assembler.classic.JndiEncBuilder$Ref
>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>
> In Openejb trunk this is certainly serialzable and I don't think we could
> have released anything with this problem.  On the other hand I have a faint
> recollection of seeing a similar problem in the past.
>
> Which geronimo version are you using?  Can you deploy your ear from the
> command line, not using eclipse?
>
> thanks
> david jencks
>
>
>
> On Mar 31, 2009, at 5:46 PM, Antonio ForniƩ wrote:
>
>
>> Hello!
>>
>> First of all, I've been looking for a similar post but surprisingly I
>> didn't
>> find anything, so I hope I'm not asking something that it's been answered
>> before.
>>
>> I'm creating a basic JEE5 app with Eclipse plugin. It all works well until
>> I
>> try to use an EJB. I've created a Dynamic Web Project, then a EJB Project
>> and finally an Enterprise Application Project in which I've included the
>> other two. It compiles without problems.
>>
>> But when I start Geronimo, and it seems everything is gone ok and the
>> server
>> is running it says:
>>
>> Geronimo startup complete
>> 00:10:32,500 INFO  [config] Configuring Service(id=Default Stateless
>> Container, type=Container, provider-id=Default Stateless Container)
>> 00:10:32,500 INFO  [config] Configuring Service(id=Default Stateful
>> Container, type=Container, provider-id=Default Stateful Container)
>> 00:10:32,500 INFO  [config] Configuring Service(id=Default BMP Container,
>> type=Container, provider-id=Default BMP Container)
>> 00:10:32,500 INFO  [config] Configuring Service(id=Default CMP Container,
>> type=Container, provider-id=Default CMP Container)
>> 00:10:32,500 INFO  [config] Configuring app: default/GeronimoEA/1.0/car
>> 00:10:32,703 INFO  [OpenEJB] Auto-deploying ejb Calculator:
>> EjbDeployment(deployment-id=GeronimoEJB.jar/Calculator)
>> 00:10:32,718 INFO  [config] Loaded Module: default/GeronimoEA/1.0/car
>> 00:10:33,609 WARN  [startup] Unresolved ejb reference
>> "com.redondel.servlet.CalcServlet/calculator" in bean "GeronimoEnc".  Will
>> attempt resolution again at runtime.
>> 00:10:33,703 WARN  [startup] Unresolved ejb reference
>> "com.redondel.servlet.CalcServlet/calculator" in bean "GeronimoEnc".  Will
>> attempt resolution again at runtime.
>> 00:10:33,921 ERROR [Deployer] Deployment failed due to
>> java.io.IOException: Unable to serialize GBeanData for
>>
>> default/GeronimoEA/1.0/car?J2EEApplication=default/GeronimoEA/1.0/car,j2eeType=WebModule,name=GeronimoWEB.war
>>        at
>>
>> org.apache.geronimo.kernel.config.SerializedGBeanState.storeGBeans(SerializedGBeanState.java:145)
>>        at
>>
>> org.apache.geronimo.kernel.config.SerializedGBeanState.writeObject(SerializedGBeanState.java:92)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>>        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
>>        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>>        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject(Unknown Source)
>>        at java.util.HashMap.writeObject(Unknown Source)
>>        at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>>        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
>>        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>>        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject(Unknown Source)
>>        at
>>
>> org.apache.geronimo.kernel.config.SerializedConfigurationMarshaler.writeConfigurationData(SerializedConfigurationMarshaler.java:66)
>>        at
>>
>> org.apache.geronimo.kernel.config.ConfigurationUtil.writeConfigurationData(ConfigurationUtil.java:216)
>>        at
>>
>> org.apache.geronimo.system.configuration.ExecutableConfigurationUtil.writeConfiguration(ExecutableConfigurationUtil.java:155)
>>        at
>>
>> org.apache.geronimo.system.configuration.RepositoryConfigurationStore.install(RepositoryConfigurationStore.java:338)
>>        at
>> org.apache.geronimo.deployment.Deployer.install(Deployer.java:348)
>>        at
>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:256)
>>        at
>> org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at
>>
>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>        at
>>
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>        at
>>
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
>>        at
>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>>        at
>> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at
>>
>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>        at
>>
>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
>>        at
>>
>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
>>        at
>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>>        at
>>
>> org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
>>        at
>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown
>> Source)
>>        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
>>        at
>> javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown
>> Source)
>>        at javax.management.remote.rmi.RMIConnectionImpl.access$200(Unknown
>> Source)
>>        at
>>
>> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown
>> Source)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at
>>
>> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown
>> Source)
>>        at javax.management.remote.rmi.RMIConnectionImpl.invoke(Unknown
>> Source)
>>        at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>>        at sun.rmi.transport.Transport$1.run(Unknown Source)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>>        at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
>> Source)
>>        at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown
>> Source)
>>        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
>> Source)
>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
>> Source)
>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>> Source)
>>        at java.lang.Thread.run(Unknown Source)
>> Caused by: java.io.IOException: Unable to write attribute:
>> componentContext
>> in gbean:
>>
>> default/GeronimoEA/1.0/car?J2EEApplication=default/GeronimoEA/1.0/car,j2eeType=WebModule,name=GeronimoWEB.war
>>        at
>> org.apache.geronimo.gbean.GBeanData.writeExternal(GBeanData.java:214)
>>        at
>>
>> org.apache.geronimo.kernel.config.SerializedGBeanState.storeGBeans(SerializedGBeanState.java:143)
>>        ... 73 more
>> Caused by: java.io.NotSerializableException:
>> org.apache.openejb.assembler.classic.JndiEncBuilder$Ref
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
>>        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>>        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject(Unknown Source)
>>        at java.util.HashMap.writeObject(Unknown Source)
>>        at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
>>        at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject0(Unknown Source)
>>        at java.io.ObjectOutputStream.writeObject(Unknown Source)
>>        at
>> org.apache.geronimo.gbean.GBeanData.writeExternal(GBeanData.java:212)
>>        ... 74 more
>>
>>
>> My code is very simple:
>>
>> public class CalcServlet extends HttpServlet{
>>        @EJB
>>        Calculator calculator;
>>
>>        @Override
>>        public void doPost(HttpServletRequest req, HttpServletResponse
>> resp) throws
>> ServletException, IOException {
>>                doGet(req, resp);
>>        }
>>
>>        @Override
>>        public void doGet(HttpServletRequest req, HttpServletResponse resp)
>> throws
>> ServletException, IOException {
>>
>>                int res = this.calculator.sum(10, 6);
>>
>>                req.setAttribute("RES", res);
>>
>>  this.getServletContext().getRequestDispatcher("/res.jsp").forward(req,
>> resp);
>>
>>   }
>> }
>>
>> ...
>>
>> @Stateless
>> public class Calculator implements CalculatorLocal, CalculatorRemote{
>>
>>        public int sum(int a, int b){
>>                return a + b;
>>        }
>>
>> }
>>
>> ...
>>
>> @Local
>> public interface CalculatorLocal {
>>        public int sum(int a, int b);
>>
>> }
>>
>> ...
>>
>> @Remote
>> public interface CalculatorRemote {
>>        public int sum(int a, int b);
>>
>> }
>>
>>
>>
>> Thank you very much!!
>> --
>> View this message in context:
>> http://www.nabble.com/Basic-EJB-app-structure-tp22817752s134p22817752.html
>> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>>
>>
>

Mime
View raw message