I have an ExceptionMapper defined as following
@Provider
public class MyExceptionMapper implements ExceptionMapper<Throwable> {
@Inject
private Manager myManager;
@Override
public Response toResponse(Throwable exception) {
// My implementation
}
}
Deploying this code on glassfish 4 results with exception:
org.glassfish.hk2.api.UnsatisfiedDependencyException:
There was no object available for injection at
Injectee(requiredType=Manager,parent=MyExceptionMapper,qualifiers {}),position=-1,optional=false,self=false,unqualified=null,955636053)
When I use @Context instead of @Inject I do not see the exception but myManager is null I tried making MyManager as @ManagedBean, @Singleton or an EJB (Stateless, Singleton) and non works