CXF: No message body writer found for class - automatically mapping non-simple resources

前端 未结 10 618
野的像风
野的像风 2020-12-08 03:59

I am using the CXF rest client which works well for simple data types (eg: Strings, ints). However, when I attempt to use custom Objects I get this:

Exceptio         


        
10条回答
  •  囚心锁ツ
    2020-12-08 04:38

    None of the above changes worked for me. Please see my worked configuration below:

    Dependencies:

                
                    org.apache.cxf
                    cxf-rt-frontend-jaxrs
                    3.3.2
                
                
                    org.apache.cxf
                    cxf-rt-rs-extension-providers
                    3.3.2
                
                
                    org.codehaus.jackson
                    jackson-jaxrs
                    1.9.13
                
                
                    org.codehaus.jettison
                    jettison
                    1.4.0
                
    

    web.xml:

         
            cfxServlet
            org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
            
                javax.ws.rs.Application
                com.MyApplication
            
            
                jaxrs.providers
                org.codehaus.jackson.jaxrs.JacksonJsonProvider
            
            
                jaxrs.extensions
                 
                json=application/json 
            
            
            1
        
        
            cfxServlet
            /v1/*
        
    

    Enjoy coding .. :)

提交回复
热议问题