Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: text/html - in Resteasy

前端 未结 7 2237
傲寒
傲寒 2021-02-18 15:39

I am developing RESTEasy Example. In this example I am using all latest dependencies and deploying om tomcat 8.x version. I can successfully deploy the applicat

7条回答
  •  甜味超标
    2021-02-18 16:18

    To be more clear, for beginners. add the

    @XmlRootElement(name = "yourClassLowerCased") at the beginning of your class, like

    package org.dlss.entities;
    import javax.persistence.*;
    import javax.xml.bind.annotation.XmlRootElement;
    
    
    @Entity //The class will be a javax.persistence Entity (could be stored in a DB)
    @Table(name = "person", schema = "public", catalog = "") //Table name
    @XmlRootElement(name = "person")
    public class PersonEntity {
    
    
        @Id //Following field will be the id of the table
        @GeneratedValue(strategy = GenerationType.IDENTITY) //Will be autoincremented when generated for type SERIAL into postgresql
        private Integer id;
    

提交回复
热议问题