0

I've generated java sources from wadl file through wadl2java maven plugin and wanted to create REST Services through Springboot jersey. It reaches the service but getting below Excetiption :

`Can not construct instance of javax.xml.bind.JAXBElement: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?) at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@198d51da; line: 5, column: 33] 

My Service endpoint is something like this:

@Path("getdetails/")
public class GetdetailsResource {
    
    @POST
    @Consumes({"application/xml", "application/json" })
    @Produces({"application/xml", "application/json" })
    public Response GETDETAILS(InputParameters parameters) {
        '''''
        System.out.println(parameters);
....
        return null;
    }

}

REST calls throws exception while Unmarshalling into creating InputParameters which has JAXBElement jaxbElement;

Somehow the JaxbElement never gets instantiated even with the ObjectMapper as mentioned here

InputParameters class is like below:

XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "carray"
})
@XmlRootElement(name = "InputParameters")
public class InputParameters {
    public InputParameters() {
        // TODO Auto-generated constructor stub
        System.out.println();
    }

    @XmlElementRef(name = "P_CONTRACT_ARRAY", namespace = "http://xmlns.oracle.com/apps/getdetails/", type = JAXBElement.class, required = false)
    protected JAXBElement<APPAXX> carray;


    public JAXBElement<APPAXX> getcarray() {
        return carray;
    }

    public void setcarray(JAXBElement<APPAXX> value) {
        this.carray = value;
    }

}
lifeline2
  • 69
  • 1
  • 15
  • 1
    ....Where is your InputParameters pojo? There should be a class that defines properties for your JSON for example.. – JCompetence Feb 04 '22 at 13:10
  • Does your InputParameters pojo have a default constructor – JCompetence Feb 04 '22 at 13:10
  • No they don't because it's generated classes. Even I've added a default constructor manually to the generated code but no luck. updated the earlier post with pojo – lifeline2 Feb 04 '22 at 14:26

0 Answers0