eclipse-ee4j / eclipse-ee4j/jersey
Bug Report: ModelValidationException when resource class and its interface both have @Path annotation (Jersey 2.30)
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
# Description #
----------
When a resource class implements an interface, and both do have an identical `@Path` annotation at its `@GET`ter method, then Jersey throws an unjustified `ModelValidationException`.
## Expected Outcome ##
No exception is thrown, but Jersey decides if it uses the `Path` annotation of the interface *or* the resource, in analogy to the case of conflicting *interfaces* explicitly allowed by the JAX-RS specification:
>The **precedence** over *conflicting* annotations defined in multiple implemented interfaces is implementation specific.
## Current Outcome ##
```
org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[HINT] Cannot create new registration for component type class org.glassfish.jersey.jsonb.internal.JsonBindingProvider: Existing previous registration found for the type.; source='null', [FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public abstract mypackage.MyType mypackage.MyInterface.myMethod(java.lang.String) and public mypackage.MyType mypackage.MyResource.myMethod(java.lang.String) at matching regular expression /([^/]+). These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@50495ca8']
## Steps to reproduce ##
* Access a resource having the exact same `@Path` annotation and otherwise identical signature as on of its implemented interfaces.
Contributor guide
Assessment
This issue has not been assessed yet.