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

前端 未结 7 2039
傲寒
傲寒 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:22

    Now I am able to solve this issue. I need to add following dependency in pom.xml:

    
            org.jboss.resteasy
            resteasy-jaxb-provider
            3.0.16.Final
    
    

    And 1) I should be using @Produces(MediaType.APPLICATION_XML) on method signature to get following response.

    
    
    0
    Ricky
    AOHP451
    
    
    1
    Mayer
    DKLP987
    
    
    

    2) If you want to use @Produces(MediaType.TEXT_PLAIN) then code will gives you following output which doesn't looks useful.

    [com.mkyong.rest.Student@4d5fd75e, com.mkyong.rest.Student@7715574d]
    

    So use 1) solution.

提交回复
热议问题