1 Reply Latest reply on May 8, 2007 5:55 AM by Pete Muir

    Problem Extending EntityHome with a SFSB

    Michael Yuan Novice

      Hi,

      Sorry if someone has already asked this ... I am having a problem extending EntityHome with EJB3 SFSBs. So, basically, I have a interface to define the methods I want to use in EntityHome:

      public interface PersonDaoInt {
       EntityManager getEntityManager();
       Object getId();
       String persist ();
       String update ();
       String remove ();
       public void destroy ();
      }
      


      Then, the bean method is like the following:

      @Stateful
      @Name("personDao")
      public class PersonDao extends EntityHome <Person>
       implements PersonDaoInt {
      
       // Configure the entity manager
       @PersistenceContext (type=EXTENDED)
       private EntityManager em;
      
       public EntityManager getEntityManager () {
       return em;
       }
      
       // Configure the HTTP GET parameter on the page
       @RequestParameter
       Long pid;
      
       public Object getId() { return pid; }
      
       // SFSB requirement
       @Remove @Destroy
       public void destroy () { }
      }
      


      But at deployment time (JBoss 4.0.5 GA), EJB3 complains the following. Does it mean the "remove()" is no longer allowed in EJB3 SFSBs?

      java.lang.IllegalArgumentException: methods with same signature remove() but incompatible return types: void and others
       at sun.misc.ProxyGenerator.checkReturnTypes(ProxyGenerator.java:610)
       at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:420)
       at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:306)
       at java.lang.reflect.Proxy.getProxyClass(Proxy.java:501)
       at org.jboss.ejb3.stateful.BaseStatefulProxyFactory.init(BaseStatefulProxyFactory.java:58)
       at org.jboss.ejb3.stateful.BaseStatefulProxyFactory.start(BaseStatefulProxyFactory.java:66)
       at org.jboss.ejb3.stateful.StatefulLocalProxyFactory.start(StatefulLocalProxyFactory.java:61)
       at org.jboss.ejb3.ProxyDeployer.start(ProxyDeployer.java:105)
       at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:124)
       at org.jboss.ejb3.stateful.StatefulContainer.start(StatefulContainer.java:91)
       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 org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy54.start(Unknown Source)
       at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:96)
       at org.jboss.ejb3.Ejb3Deployment.registerEJBContainer(Ejb3Deployment.java:281)
       at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:328)
       at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
      ... ...
      


      Anyone know what's going on? Thanks. Please let me know if you want more error trace.

      cheers
      Michael