You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Kory Markevich <Ko...@ACL.com> on 2008/11/06 01:41:06 UTC

ApplicationException annotation ignored

I have a fairly simple EAR that I'm developing using Geronimo 2.1.2 and thus
whatever version of OpenEJB it uses, making use of EJB 3.  I've been trying
to flag an exception with the @ApplicationException annotation but it
doesn't seem to be processed.  I've been using Eclipse 3.4 to develop it.

The EAR consists of one stateless bean defined in an EJB project, it's local
interface + exception defined in another project, and the EAR project itself
which contains these two.  There's also a connector in there for DB stuff,
but it's unimportant.

So as assembled and deployed by Eclipse, leaving out the RAR and META-INFs:

EAR file
|_ EJB.jar
    |_ StatelessSessionBean class
|_ EJB_client.jar
    |_ LocalInterface class
    |_ AppException class

Now when I debugged the deploy process, I noticed that the Assembler would
try to loop through all the defined application exceptions, but there were
none.  Next I looked in the AnnotationDeployer.DiscoverAnnotatedBeans class
and the findAnnotatedClasses(ApplicationException.class) call in deploy.  It
is returning nothing.  I haven't bothered to grab the source for the class
finder, but from looking at it the classloader that it uses has only loaded
the StatelessSessionBean and LocalInterface classes.  The AppException
doesn't seem to be loaded anywhere.

I'm sure there's something really simple I'm overlooking but I can't find
it.  What are the basic requirements to use the ApplicationException
annotation with OpenEJB properly?
-- 
View this message in context: http://www.nabble.com/ApplicationException-annotation-ignored-tp20353137p20353137.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: ApplicationException annotation ignored

Posted by Kory Markevich <Ko...@ACL.com>.
Oh, I had actually looked at that one but I guess I misunderstood the scope
of "separate module."  Sorry about that, and thanks for the workaround.


David Blevins wrote:
> 
> 
> This is the issue you're facing:
> 
>    https://issues.apache.org/jira/browse/OPENEJB-835  
> "@ApplicationException ignored when class exists in separate module"
> 
> 

-- 
View this message in context: http://www.nabble.com/ApplicationException-annotation-ignored-tp20353137p20366604.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: ApplicationException annotation ignored

Posted by David Blevins <da...@visi.com>.
On Nov 5, 2008, at 4:41 PM, Kory Markevich wrote:

>
> I have a fairly simple EAR that I'm developing using Geronimo 2.1.2  
> and thus
> whatever version of OpenEJB it uses, making use of EJB 3.  I've been  
> trying
> to flag an exception with the @ApplicationException annotation but it
> doesn't seem to be processed.  I've been using Eclipse 3.4 to  
> develop it.
>
> The EAR consists of one stateless bean defined in an EJB project,  
> it's local
> interface + exception defined in another project, and the EAR  
> project itself
> which contains these two.  There's also a connector in there for DB  
> stuff,
> but it's unimportant.
>
> So as assembled and deployed by Eclipse, leaving out the RAR and  
> META-INFs:
>
> EAR file
> |_ EJB.jar
>    |_ StatelessSessionBean class
> |_ EJB_client.jar
>    |_ LocalInterface class
>    |_ AppException class
>

Hi Kory,

This is the issue you're facing:

   https://issues.apache.org/jira/browse/OPENEJB-835  
"@ApplicationException ignored when class exists in separate module"

It's closed and fixed in the recently released OpenEJB 3.1 and will be  
pulled into Geronimo 2.2 when that is released.

In the meantime, you can explicitly list the ApplicationException in  
an ejb-jar.xml added to the EJB.jar like this:

<ejb-jar>
     <assembly-descriptor>
         <application-exception>
             <exception-class>AppException</exception-class>
             <rollback>false</rollback>
         </application-exception>
     </assembly-descriptor>
</ejb-jar>


-David