geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay D. McHugh" <jaydmch...@gmail.com>
Subject Re: Basic EJB app structure
Date Tue, 07 Apr 2009 20:12:49 GMT
Hello Antonio,

Whenever I see that 'GeronimoENC' in a stack trace I double check to
make sure that I have annotated my session beans correctly.

Did you make sure to add the '@Stateless' annotation in Calculator.java?

Jay

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!!

Mime
View raw message