Title: RE: New error...

So, this means that I now have to make all of my beans conform to the EJB2.0 spec rather than the EJB1.1 spec that they already conform to?  I tried adding the required throws onto the method declaration (e.g. public MDXAccountingCodeKey ejbCreate(...) throws RemoteException, CreateException, DuplicateKeyException), and it actually created another error.  Is there some other way I need to be defining javax.ejb.CreateException?  Why the switch to the EJB 2.0 spec?

-----Original Message-----
From: Philippe Coq [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 06, 2001 12:25 AM
To: Skidmore, Walt
Cc: '[EMAIL PROTECTED]'
Subject: Re: New error...


> "Skidmore, Walt" wrote:
>
> I just went from version 2.2.6 to 2.2.7, and these are the errors I'm
> now getting when I run GenIC:
>
> ------------------------------------------------------------------------------------------
>
> ./medinex/server/entitybean/JOnASMDXAccountingCodeBean.java:61:
> unreported exception javax.ejb.DuplicateKeyException; must be caught
> or declared to be thrown
>
>         throw new javax.ejb.DuplicateKeyException(pk.toString());
>         ^
>
> ./medinex/server/entitybean/JOnASMDXAccountingCodeBean.java:85:
> unreported exception javax.ejb.CreateException; must be caught or
> declared to be thrown
>
>         throw new javax.ejb.CreateException(e.toString());
>         ^
>
> ./medinex/server/entitybean/JOnASMDXAccountingCodeBean.java:323:
> unreported exception javax.ejb.RemoveException; must be caught or
> declared to be thrown
>
>         throw new javax.ejb.RemoveException(e.toString());
>         ^
> -------------------------------------------------------------------------------------------
>
> Do I need to change my methods in the bean? (e.g. from "public
> MDXAccountingCodeKey ejbCreate(...)" to "public MDXAccountingCodeKey
> ejbCreate(...) throws {exception}")  This hasn't been an issue in the
> past...  The thing that baffles me is that it's generated code that
> javac is taking issue with...
>
> Any help would be greatly appreciated.
>
>

Hi,
in JOnAS 2.2.7 we have made modofoication in order to catch correctly
CreateException,
DuplicateKeyException, RemoveException
the generated code by GenIc has changed and now as I said in a previous
Mail
Fri, 09 Feb 2001
Re: CreateException in ejbCreate does not get through to the client

"The only problem I see (I hope it is a minor one) : as the generated
code CMP throw CreateException and RemoveException it is mandatory for
the bean
provider to define javax.ejb.CreateException in the throws clause of
ejbCreate<METHOD> methods
and to define javax.ejb.RemoveException in the throws clause ejbRemove
method.
It was not mandatory in the current version of JOnAS (2.2.6) so some
existing
beans may not compile anymore as it.

Note that the EJB2.0 specification says:
�9.7.5 ejbCreate<METHOD>methods:
The throws clause MUST define javax.ejb.CreateException. The throws
clause may define arbitrary application specific exceptions.
The EJB1.1 Specification was saying:
�9.2.3 ejbCreate methods:
The throws clause MAY define arbitrary application specific exceptions,
including the javax.ejb.CreateException"

So you must add the correct throws clause to your ejbCreate, ejbRemove
method
according to the Specification 2.0

Best regards,



--
        Philippe

Philippe Coq  Evidian   Phone: (33) 04 76 29 78 49
Bull S.A  - 1 rue de Provence - 38432 Echirolles Cedex France
Download our EJBServer at http://www.objectweb.org

Reply via email to