Jetty 9.0 embedded and RestEasy 3.0 keeps throwing NoSuchMethodError

后端 未结 4 1939
北恋
北恋 2020-12-31 19:40

Today I had the idea to build a very simple web application, which would be powered by a REST backend. Since I wanted a very lightweight server I started looking at Jetty. A

4条回答
  •  死守一世寂寞
    2020-12-31 20:12

    I just stumbled upon the same issue. The solution was to add the jaxrs-api explicitly as the first dependency in the list of dependencies.

    
      
      
        org.jboss.resteasy
        jaxrs-api
        3.0.4.Final
      
      
     
    

    Jackson uses the jsr311-api that provides the same Response class that is used by the BuiltResponse class. Unfortunately, this Response does not contain the getHeaders() method. So even though the dependency is resolved, it is using a wrong class. If somehow the Jackson dependency gets before the Resteasy one, then the exception above will be raised.

提交回复
热议问题