[
https://issues.apache.org/jira/browse/CXF-8097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17006804#comment-17006804
]
Carsten D edited comment on CXF-8097 at 1/2/20 1:26 PM:
--------------------------------------------------------
[~coheigea]
I have now managed to mostly strip my project to reproduce the problem. Please
see [^cxf-8097-mcve.zip].
You may run this server after extracting it with
{code}
./gradlew runTestServer
{code}
Afterwards you should be able to trigger this warning by sending HEAD and GET
requests:
{code}
// this is the HEAD request which produces the WARN log statement
curl --location --head 'http://localhost:8989/api/test/path/x/y/z/test'
// this calls a different method but on the same path, this does not produce
the log statement
curl --location --request GET 'http://localhost:8989/api/test/path/x/y/z/test'
{code}
Output:
{code}
2020-01-02 14:18:01,509 INFO [qtp1970436060-24] []
[ServletRequestLogHandler.handle:23] Request: HEAD /api/test/path/x/y/z/test,
Content-Type: null, Body: 0 bytes
2020-01-02 14:18:01,595 WARN [qtp1970436060-24] [] [JAXRSUtils.compare:129]
Both com.test.app.rest.service.impl.TestRestServiceImpl#test and
com.test.app.rest.service.impl.TestRestServiceImpl#testAsHeadRequest are equal
candidates for handling the current request which can lead to unpredictable
results
2020-01-02 14:18:01,599 INFO [qtp1970436060-24] []
[TestRestServiceImpl.testAsHeadRequest:46] HEAD request
2020-01-02 14:18:01,630 INFO [qtp1970436060-24] []
[ServletRequestLogHandler.handle:33] Response -- Status: 200, Content-Type:
application/octet-stream
{code}
was (Author: carsten.d):
[~coheigea]
I have now managed to mostly strip my project to reproduce the problem. Please
see [^cxf-8097-mcve.zip].
You may run this server after extracting it with
{code}
./gradlew runTestServer
{code}
Afterwards you should be able to trigger this warning by sending HEAD and GET
requests:
{code}
// this is the HEAD request which produces the WARN log statement
curl --location --head 'http://localhost:8989/api/test/path/x/y/z/test'
// this calls a different method but on the same path, this does not produce
the log statement
curl --location --request GET 'http://localhost:8989/api/test/path/x/y/z/test'
{code}
> Equal candidates for handling the current request (HEAD / GET)
> --------------------------------------------------------------
>
> Key: CXF-8097
> URL: https://issues.apache.org/jira/browse/CXF-8097
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.3.2, 3.3.3
> Reporter: Carsten D
> Priority: Major
> Attachments: Screenshot 2019-12-17 at 08.44.29.png, cxf-8097-mcve.zip
>
>
> I have just migrated a very outdated Spring backend to Spring 5 and with it
> upgraded CXF to first 3.3.2 and just now 3.3.3. I have a REST service class
> defining two different methods with the same path defined via
> {{javax.ws.rs.Path}} annotation, differentiated by {{javax.ws.rs.HEAD}} and
> {{javax.ws.rs.GET}} annotations. Both methods are annotated with
> {{@Produces(MediaType.APPLICATION_OCTET_STREAM)}}.
> When this method is called I get (redacted):
> {{WARN [JAXRSUtils.compare:129] Both ServiceRestImpl#getFile and
> ServiceRestImpl#getFileAsHeadRequest are equal candidates for handling the
> current request which can lead to unpredictable results}}
> The differentiation works: HEAD requests are handled by the {{@HEAD}}
> annotated method and GET requests by the {{@GET}} annotated one (this has
> always worked). Therefore the warning is false but will severely clutter
> production log output, possibly affect performance.
> Relevant dependencies:
> * Spring framework 5.1.8
> * "org.apache.cxf", "cxf-rt-rs-service-description", "3.3.3"
> * "javax.servlet", "javax.servlet-api", "4.0.1"
> * "javax.ws.rs", "javax.ws.rs-api", "2.0.1"
> I'd appreciate support. May be linked to:
> * CXF-7670
> * CXF-6684
--
This message was sent by Atlassian Jira
(v8.3.4#803005)