Using a stateless as handler is very surprising bit should work only if cdi
is activated.

If not you have a plain pojo IIRC.
Le 14 nov. 2015 02:40, "Rentius" <rentius2407...@gmail.com> a écrit :

> 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.
>

Reply via email to