2 Replies Latest reply on Mar 2, 2015 11:51 AM by michael.burger

    Wildfly 8.2 Jackson Class has no default Constructor

    michael.burger

      Hi,

       

      I have an REST resurce which returns a PagedResult<Institution> Object! But with Wildfly 8.2 I get the error

      "Class it.siag.maps.infa has no default construuctor; can not instantiate default bean value to support 'properties=JsonSerialize.Inclusion.NON_DEFAULT' annootation"

      With Wildfly 8.1 everything works fine!

       

      I don't know why the JacksonProvider will inject my PagedResult with the default constructor if i creat it with an custom constructor!

      To say is, this problem occurse only on Wildfly 8.2 installed on my UBUNTU system, on RedHat or Windows it works fine!

       

      See here a snippet of my two classes

       

      @Path("institutions")

      @Stateless

      @Api(value = "/institutions", description = "Api related to institutions")

      public class InstitutionResource {

      ....

      @GET

          @Produces(MediaType.APPLICATION_JSON)

          @ApiOperation(value = "Retrieves a list of all Institutions", response = InstitutionDto.class)

          public PagedResult<Institution> getAll(@QueryParam("page") Integer page, @QueryParam("rows") Integer rows,

                  @QueryParam("sidx") String sortIndex, @QueryParam("sord") String sortOrder) {

       

              List<Institution> institutions = new ArrayList<Institution>();

              Institution institution = new Institution();

              institution.setId(1L);

              institution.setInstitutionDE("DE");

              institution.setInstitutionIT("IT");

             

              institutions.add(institution);

             

              return new PagedResult<Institution>(institutions, 1, 1, 1);

           }

       

       

      =========================

      public class PagedResult<TEntity> {

          private final static Logger logger = Logger.getLogger(PagedResult.class);

       

          private List<TEntity> rows;

          private int currentPage = 1;

          private int pageSize = 1;

          private long totalItems = 1;

         

      //    public PagedResult() {

      //        super();

      //        logger.warn("BBBBBBBBBBBB");

      ////        try {

      ////            String x = null;

      ////            x.toLowerCase();

      ////        } catch (Exception ex) {

      ////            ex.printStackTrace();

      ////        }

      //    }

       

          public PagedResult(List<TEntity> rows, int currentPage, int pageSize, long totalItems) {

              logger.warn("AAAAAAAAAA");

              this.rows = rows;

              this.currentPage = currentPage;

              this.pageSize = pageSize;

              this.totalItems = totalItems;

          }

       

      ====================

       

      can anyone help me?

       

      thx

        Michael