1 Reply Latest reply on Jan 22, 2004 5:25 AM by S

    excpetions to be thrown in ejbCreate() ?

    Markus Joschko Newbie

       

      "jocsch" wrote:
      Hi,
      I'm a little bit confused about which exception I should declare to be thrown in the ejbCreate() method. I tried different combinations with different results.

      The preface: I have a stateless session bean with a home interface and a local home interface. The home interface create method throws a create and a remote exception, while the local home interface only throws a createexception.

      What exception should be thrown in the bean ejbcreate? If I throw declare create and remoteexception to be thrown, jboss gives me the following warning while deploying the bean:

      11:47:36,328 INFO [EJBDeployer]
      Bean : pageSMS/PSserverEJB
      Method : public abstract PSserverEJBLocal create() throws CreateException
      Section: 7.10.8
      Warning: All the exceptions defined in the throws clause of the matching ejbCreate(...) method of the enterprise bean class must be included in the throws clause of a matching create(...) method.


      I think it's because the localhome interface doesn't throw the remoteexcpetion.

      If I declare to throw no excpetion in the beans ejbcreate, jboss is satisfied during deployment so I think, that is correct, or?

      But there is a second more heavyweight problem with all this exception stuff. If I redeploy the bean (doesn't matter which exception configuration ...) and give it a call, I always get this error:

      ERROR [STDERR] java.rmi.ServerException: Invalid invocation, check your deployment packaging, method=public abstract de.freaquac.pageSMS.server.interfaces.PSserverEJB de.freaquac.pageSMS.server.interfaces.PSserverEJBHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException; nested exception is:
      javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract de.freaquac.pageSMS.server.interfaces.PSserverEJB de.freaquac.pageSMS.server.interfaces.PSserverEJBHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException


      Looks like a problem with the exceptions declared to be thrown in the create method (for better understanding:The ejbcreate method has an empty body, so there can be no code problem).
      If I restart jboss, I can call the bean without problems. It's a redeployment problem.

      Anybody know what to do to solve this problem? It's really nasty to restart jboss all the time I redeploy.

      Thx for reading,
      MArkus