The Bean Provider defines application exceptions. Application exceptions that are checked exceptions may be defined as such by being listed in the throws clauses of the methods of the bean�s business interface, home interface, component interface, and web service endpoint. An application exception that is an unchecked exception is defined as an application exception by annotating it with the ApplicationException metadata annotation, or denoting it in the deployment descriptor with the application-exception element.
So you will have to declare IllegalArgumentException in throws clause of the method or defined it as an application exception through the annotation or deployment descriptor.
Thanks for the reply,
I dont think that specifying unchecked IllegalArgumentException in throws clause, IllegalArgumentException becomes an Application Exception.
Since its is already compiled we cant use annotations also, My next question is can we use deployment descriptor,
And isnt there any Application Exceptions defined in JDK?
Originally posted by Chaminda Amarasinghe:
Christophe, I cant belive Jaikiran since IllegalArgumentException is not an Checked Exception.
Good point I was under the impression that any exception in the throws clause of the bean interface will be considered as ApplicationException. Looks like i am wrong
I even decided to read the "System Exceptions" section in the spec to see what it contains. And the statement in this section now confuses me:
A system exception is an exception that is a java.rmi.RemoteException (or one of its subclasses) or a RuntimeException that is not an application exception.
The latter part of the statement confuses me. So we can have a RuntimeException (which is termed as "unchecked") as an application exception? If this is possible, then i think declaring this IllegalArgumentException (which is an RuntimeException) in the throws clause should have behaved as an application exception.
I am a bit confused right now, but let me do more reading to see what's expected