Set JSON provider at RESTEasy on JBoss 7.1.1

前端 未结 4 1256
执念已碎
执念已碎 2021-02-15 17:26

How could I set JSON provider for RestEasy at JBoss 7.1.1?

RestEasy documentation says:

RESTEasy allows you to marshall JAXB annotated POJOs to an

4条回答
  •  情深已故
    2021-02-15 17:59

    As a follow-on to ahus1's answer: if you have a multi-level deployment archive (i.e. a top-level EAR file containing an EJB jar and a war file), you will need to configure the exclusion of org.jboss.resteasy.resteasy-jackson-provider on whichever sub-deployment contains the RESTEasy/JAX-RS components.

    In my deployment, for example, my REST endpoints were annotated on top of EJBs in my EJB jar file, while my @ApplicationPath-annotated javax.ws.rs.core.Application subclass which activates RESTEasy was in my war file. I found that the approaches of putting the exclusions solely on the top-level (EAR) deployment (as in ahus1's example) or on the EJB-jar-level deployment were ineffective, but I finally got RESTEasy to use Jettison rather than Jackson by putting the exclusions on all 3 levels (EAR, EJB, Web):

    
    
        
            
                
            
            
                
            
        
        
            
                
            
            
                
            
        
        
            
                
            
            
                
            
        
    
    

    It's very likely that I only needed the exclusions on the subdeployments, and putting it on the main EAR deployment is superfluous; I didn't try it that way, since for now putting it on all three seems to work perfectly well.

提交回复
热议问题