InjectParamsTest TCK test failure with CXF #168
Comments
Hi @chkal , I did the test without Ozark, following the same TCK model, and it executes and displays the output when @QueryParam is used in an attribute. with Ozark this value is Null . test using TomEE 7.0.4 and 7.0.5 |
That's weird. I don't know why Ozark could cause this. Maybe because Ozark ships with a custom Could you perhaps debug if this method is executed and how it behaves? Perhaps you could even debug how the CXF code calling |
I will look too . |
Hi @chkal , I made the debug, but I could not identify the default CXF, after it passes the MVCConverterProvider.getConverter () it comes null and then the same goes to the following method of the CXF class:
here in the case the class InjectionsUtils
it can idendify the value passed by the @QueryParam, but in the end it returns null now using @QueryParam as paramenter in the method it works normal with Ozark. Now without Ozark, the InjectParam will work with CXF. |
Thanks for sharing this analysis. Do you have the sample app available you used for this? |
Hi @chkal , can I do, in case you one with Ozark and another without? step a zip here or a link to some repository. |
Awesome! A link to a repository would be great! |
Hi @chkal , follows the examples with InjectParam with and without Ozark, I did the tests with TomEE 7.0.5. |
Thanks @Daniel-Dos. I'll have a look, but it may take some time, as I'm on vacation for the next two weeks. |
I experimented a bit with this issue. It is really weird. Using `@QueryParam' on a resource field doesn't work, but it is working fine if I place the annotation on the corresponding getter instead. Also the issue is occurring even if I don't register I just created CXF-7834 with a description of my observations. Let's see what they think about this issue. |
wonderful. It really is pretty weird. even with the response of the CXF team, could not reproduce what happened. Now it is investigating if it is some component that Ozark uses that is generating this problem thank you. |
I'm not really sure what is causing this. I'm planning to setup some minimal sample environment (Tomcat + CXF + Weld) to see if I can reproduce it there. I don't think that Ozark is causing this. I removed our ParamConverterProvider and the issue still occurred. This is really weird. |
I get it, it's really weird. |
Hi @chkal & @Daniel-Dos , I made a bit more debugging of reproducer applications from Daniel and found a reason for this bug. I used TomEE 7.1.0 plus for this investigation. It contains CXF v.3.1.15 library.
we have in method InjectionUtils#injectFieldValue(...) a pure instance of JAX-RS controller: So finally field But in the case of Ozark + CXF application, we have an instance of OwbInterceptorProxy for injection. And real instance of the Controller class not changed there:
So, for me, it looks like a problem with the integration of CXF and OpenWebBeans. CXF doesn't understand that it works with CDI proxy and thus it doesn't inject query param properly. I will try to prepare reproducer project only with JAX-RS and CDI components. Regards, |
It is funny that CXF actually has a mechanism to detect proxies in class ClassResourceInfo:
However, check |
It is enough to add annotation |
AWESOME! Thanks a lot @dmaidaniuk for digging into this. I already assumed that it has something to do with the CDI integration. I just reopened CXF-7834 and included a link to your summary. I hope that this will help the CXF devs to reproduce this. If anyone already has a minimal sample app (without Ozark) that reproduces this, feel free to attach it to the upstream CXF issue. Thanks! |
Hi @dmaidaniuk , very good. I made the change in the example as presented by you. thank you so much. |
Hi all. There is a new comment in the upstream CXF issue. Did anyone ever create a reproducer for the latest CXF version? Maybe a sample app which contains OWB and CXF in |
Hi @chkal, I can try to create an example later using CXF 3.2.6. |
@Daniel-Dos That would be awesome! 🍻 |
Hi @chkal , I did the test using the latest version of CXF CXF 3.2.6 and also did it with 3.1.17 with Tomcat. but the injection of param paramenter does not work, still returns blank although it has taken the information as in the image. The example is in this link : https://github.com/Daniel-Dos/InjectParamsTest-Ozark-CXF/tree/master/OnlyCXFTomcat with following endpoint : http://localhost:8080/only.cxf.tomcat/rest/app/hello/param?fieldValue=ola doc : http://cxf.apache.org/docs/using-cxf-and-cdi-11-jsr-346.html |
Great! Thanks a lot! Could you post a link to your example in the upstream issue CXF-7834? |
The TCK verifies that parameters can be injected into resource fields and properties as required by the JAX-RS spec.
Unfortunately one of the tests fails with CXF.
This test basically verifies, that a resource field can be annotated with
@QueryParam
and that the value of a corresponding parameter is injected into this field.https://github.com/mvc-spec/mvc-tck/blob/c050db27be170ff8fc7f0f41ab61e45c6b69fcc7/tests/src/main/java/org/mvcspec/tck/tests/mvc/controller/inject/InjectParamsController.java#L35-L36
I don't understand why this fails. It works fine with Glassfish and Wildfly. I don't think that this is something caused by Ozark. Perhaps CXF doesn't support injection into resources fields correctly?
It would be great if somebody could help verifying this.
The text was updated successfully, but these errors were encountered: