Our current wildfly 24 application has EJB that are being exposed through resteasy .
We have a project, rest-beans , that all the rest exposed beans are defined there:
rest-beans.war
| ---- WEB-INF/web.xml
| ---- classes
inside the web.xml we define the beans that are exposed for rest:
<context-param>
<!-- JNDI locations of EJBs that are acting as Rest resources and sitting
in this war file -->
<param-name>resteasy.jndi.resources</param-name>
<param-value>java:module/MyEJBResource1, java:module/MyEJBResource2
</param-value>
</context-param>
Additionally we define an ExceptionMapper , that catches will map exceptions.
In MyEJBResource1 we have a following code:
@EJB InternalEJB internalEJB;
public Response getMyData( UserId userId ) {
// Get data from internal EJB
try {
InternalData internalData = internalEJB.getInternalData(userId);
} catch (MyNotFoundException e) {
throw new MySpecialRestException(e, my_context, userId);
}
}
The logic inside getInternalData is something like:
public InternalData getInternalData(UserId userId) {
if (!userService.UserExists(userId)) {
throw new MyNotFoundException("UserId " + userId + " Not Found");
}
/// rest of the logic, not relevant to the question.
}
In wildfly 24 the exception mapper is being invoked only after MySpecialRestException is thrown. While in wildfly 26 the exception mapper is being invoked when MyNotFoundException is being thrown, which is totally unexpected. Additionally the exception is being wrapped up in the following way:
EJBException
|-- UndeclaredThrowableException
| -- PrivilegedActionException
| -- MyNotFoundException
How is it possible to revert back to the previous behaviour that the ExceptionMapper is being invoked only on exception that are coming from the EJBs that are exposed to rest endpoint, i.e. only the EJBs that have an actual interaction with the customer.
Thanks a lot, Elia