I'm trying to inject a local @Stateless EJB into a Rest exception handler but
getting the following error.
java.lang.NullPointerException.
The maven Web project is running on Apache-tomee-1.7.1-jaxrs.
The EJB:
@Stateless(name = "Test")
public class Test {
public void sayHello() {
System.out.println("Hello");
}
}
The Exception handler.
@Provider
@Stateless
public class TestExceptionHandler implements ExceptionMapper<Throwable> {
@Context
HttpServletRequest request;
@Inject
Test test;
@Override
public Response toResponse(Throwable throwable) {
test.sayHello();
return Response.ok().build();
}
}
I followed the tutorial
http://blog.iadvise.eu/2015/06/01/jee-using-ejb-and-context-annotations-in-a-jax-rs-provider-class/
Am I missing any configuration in the tomee server or in my code?
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/Injecting-EJB-into-Rest-Exception-Handler-tp4676781.html
Sent from the TomEE Dev mailing list archive at Nabble.com.