Adam Bien's Weblog

Unwrapping Exceptions With ApplicationException

ApplicationException annotation is often used at project-specific checked exception to force the application server to rollback the transaction:


@ApplicationException(rollback=true)
public class MyException extends Exception{}

However, the main feature is already well described in the JavaDoc:

"Applied to an exception to denote that it is an application exception and should be reported to the client directly (i.e., unwrapped)."[javadoc]

Omitting the wrapping is particularly useful in microservice architectures implemented with JAX-RS (screencast).

See you at Java EE Workshops at Munich Airport, Terminal 2, particularly at: Effective Java EE 7 and / or Java EE 7 Microservices!


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

So this will not be wrapped into EJBException?

Posted by elo on November 17, 2016 at 08:59 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License