javax.servlet.http.HttpServletResponse.getStatus() not found

后端 未结 2 1375
清歌不尽
清歌不尽 2020-12-19 14:37

I am working with an embedded Jetty server, deploying a Jersey REST api, and I am trying to log the errors, with log4J. When an error happens, for instance a URL not found,

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-19 15:34

    You have a really old servlet-api jar present in your project.

    javax.servlet.http.HttpServletResponse#getStatus() was added in Servlet 3.0

    Add the following:

    
      javax.servlet
      javax.servlet-api
      3.1.0
    
    

    Dump your dependencies and verify that you don't have multiple versions of the servlet-api jars present (this is common, as the maven coordinate space for the servlet-api jars have changed a few times over the past 10 years)

    $ mvn dependency:tree
    

提交回复
热议问题