Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jersey-dev] Jersey 2.x ExceptionMapper not handling Exceptions in Resource Constructor (worked with 1.9)


stumbled across the same question as this one:

In my case it looks like this:

    protected ResourceBase(final UriInfo uriInfo, final Request
request, final MediaTypes mediaTypes, final URI uri,
            final Service service, final
com.atomgraph.processor.model.Application application, final Ontology
ontology, final TemplateCall templateCall,
            final HttpHeaders httpHeaders, final ResourceContext
        super(uriInfo, request, mediaTypes, uri, service);

        if (templateCall == null) throw new
NotFoundException("Resource has not matched any template");

I expect NotFoundExceptionMapper to be invoked and return 404, but
instead I get 500:

processor-custom_1        | 06-Apr-2020 07:35:36.544 WARNING
[http-nio-8080-exec-3] org.glassfish.jersey.internal.Errors.logErrors
The following warnings have been detected: WARNING: Unknown HK2
failure detected:
processor-custom_1        | MultiException stack 1 of 2
processor-custom_1        |
com.atomgraph.core.exception.NotFoundException: Resource has not
matched any template
processor-custom_1        |     at
processor-custom_1        |     at
processor-custom_1        |     at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Is this not a valid use case? It did work with Jersey 1.9, so I don't
see why not.


Back to the top