opensearchserver icon indicating copy to clipboard operation
opensearchserver copied to clipboard

Error: searchFieldTemplate are equal candidates for handling the current request

Open emmanuel-keller opened this issue 7 years ago • 1 comments

Message repeating multiple times in logs:

org.apache.cxf.jaxrs.utils.JAXRSUtils - Both com.jaeksoft.searchlib.webservice.query.search.SearchImpl#searchFieldTemplate and com.jaeksoft.searchlib.webservice.query.search.SearchImpl#searchFieldTemplate are equal candidates for handling the current request which can lead to unpredictable results

emmanuel-keller avatar Jun 19 '17 21:06 emmanuel-keller

I have a similar problem. When CXF collects the rest resource methods at startup, it will find both

@Override
        public SearchResult searchFieldTemplate(String index, String login, String key, String template,
                        SearchFieldQuery query) {

and the method it overrides

       @POST
        @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
        @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
        @Path("/field/{template_name}")
        public SearchResult searchFieldTemplate(
                        @PathParam("index_name") String index,
                        @QueryParam("login") String login, @QueryParam("key") String key,
                        @PathParam("template_name") String template, SearchFieldQuery query);

While they both have the same annotated method as root, CXF does not care (I think that is the bug) and registers both method as rest resource methods without warning. When serving requests, CXF will find both resource methods, finds that they are literally the same at comparison, that is where CXF logs warnings. Quite an annoying one, all CXF 3.2 releases affected. I hope this helps.

K0zka avatar Feb 19 '18 19:02 K0zka