cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Using two javax @BeanParam beans in the same method signature results in InternalServerErrorException
Date Fri, 16 Oct 2015 10:42:29 GMT
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
>


Mime
View raw message