Hi Sergey,

Sorry it took a little longer to reply. So, I did try with CXF
2.7.18-SNAPSHOT today, but had the same results.
CXF 3.1.3 failed to compile, as maven is reporting a convergence
error, so I couldn't test that. (I'm not too surprised; I was told by
colleagues we couldn't move to version 3 just yet.)

I'm not quite sure what you mean by prototyping, but I suspect you'd
like to see what the beans look like?
They are each standalone public classes, with private fields and
public getters - some of which hold logic.
What I noticed is that a signature like doFoo(@BeanParam Bar bar,
@MatrixParam("p2") p2, ...) works, while doFoo(@BeanParam Bar bar1,
@BeanParam Bar bar2, ...) fails. So I'm tempted to rule out the beans
themselves as the cause to the issue...

Anyway, this is what the beans roughly look like:

public class Bar {
    @MatrixParam("mp1") private String mp1;
    @MatrixParam("mp2") private String mp2;
    @PathParam("pp")  private String pp;

    public String getMP1() { return mp1; }
    public String getMP2() { if(null != mp2) { return mp2; } else {
return pp; } }
    public String getPP() { if(null != mp1) { return getMP1(); } else
{ return getMP2(); } }
}


public class Baz {
    @MatrixParam("a") private String a;
    @PathParam("b") private String b;

    public getA() { return a; }
    public boolean isB() { if(b == null || b.equalsCase("") { return
false; } return true; }
}

I also cross-posted to StackOverflow last week, and someone there
could replicate the issue, it seems:
http://stackoverflow.com/a/33191716/2018047

Hope that helps in narrowing it down a bit...

Brgrds,
Christian
P.S.: With my CXF knowledge being extremely limited, looking at the
diffs for your test, I am wondering what URL you actually use - and
where you execute the actual HTTP call?

On Sun, Oct 18, 2015 at 4:05 PM, Sergey Beryozkin <sberyoz...@gmail.com> wrote:
> Hi
>
> I've added this test to 2.7.18-SNAPSHOT:
>
> http://git-wip-us.apache.org/repos/asf/cxf/commit/abc7838f
>
> Can you please prototype Bar and Baz beans, and tell more about their access
> level, perhaps one of these classes is not public or is nested ?
>
> Also try 2.7.18-SNAPHOT (in a day or two), but also CXF 3.1.3.
> While the best effort was made to have as many JAX-RS 2.0 features be
> available to CXF 2.7.x users as possible, it it possible the relevant
> implementation in 2.7.x is less robust
>
> Thanks, Sergey
>
>
>
> On 16/10/15 11:42, Sergey Beryozkin wrote:
>>
>> Hi Christian
>>
>> Thanks for reporting it - I'll look into it shortly.
>> Multiple BeanParams in a single signature are allowed indeed
>> Cheers, Sergey
>> On 16/10/15 11:32, Christian Balzer wrote:
>>>
>>> Hello all,
>>>
>>> We are using Spring and Apache CXF.
>>>
>>> For the following example code, I get an exception. Which makes me
>>> wonder: can I use two BeanParam annotations/beans in the same method
>>> signature?
>>>
>>> import javax.ws.rs.BeanParam;
>>> //...
>>> @GET
>>> @Produces({"application/json;charset=UTF-8"})
>>> public Response doFoo(
>>>          @BeanParam Bar bar,
>>>          @BeanParam Bas bas,
>>>          @Context UriInfo uriInfo)
>>>          throws BazException {
>>>
>>> Here is the stack trace:
>>>
>>> javax.ws.rs.InternalServerErrorException: null
>>> at
>>>
>>> org.apache.cxf.jaxrs.utils.SpecExceptions.toInternalServerErrorException(SpecExceptions.java:77)
>>>
>>> ~[cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>> at
>>>
>>> org.apache.cxf.jaxrs.utils.ExceptionUtils.toInternalServerErrorException(ExceptionUtils.java:110)
>>>
>>> ~[cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>> at
>>>
>>> org.apache.cxf.jaxrs.utils.JAXRSUtils.createBeanParamValue(JAXRSUtils.java:975)
>>>
>>> ~[cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>> at
>>>
>>> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:767)
>>>
>>> ~[cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>> at
>>>
>>> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:716)
>>>
>>> ~[cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>> at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:265)
>>> [cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>> at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
>>> [cxf-rt-frontend-jaxrs-2.7.15.jar:2.7.15]
>>>
>>> In JAXRSUtils, I can see this:
>>>
>>> BeanParamInfo bmi =
>>> ProviderFactory.getInstance(m).getBeanParamInfo(clazz);
>>> if (bmi == null) {
>>>      // we could've started introspecting now but the fact no bean info
>>>      // is available indicates that the one created at start up has been
>>>      // lost and hence it is 500
>>>      LOG.warning("Bean parameter info is not available");
>>>      throw ExceptionUtils.toInternalServerErrorException(null, null);
>>> }
>>>
>>> Which is the exception that gets thrown.
>>>
>>> Is there any hint in this on what I'm doing wrong? Things seem to work
>>> when I comment out the "@BeanParam Bas bas," line... Am I maybe not
>>> allowed to use two @BeanParam in the same method signature? (I
>>> couldn't find any hint that I wouldn't be, though...)
>>>
>>> Kind regards,
>>>
>>> Christian
>>> P.S.: This is a cross-post from StackOverflow:
>>> http://stackoverflow.com/q/33168074/2018047
>>>
>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/

Reply via email to