Skip to content

ServletWebRequest.checkNotModified attempts to call HttpServletResponse.getHeader(String) on Servlet 2.5 [SPR-13420] #17999

Closed

Description

@spring-projects-issues

Jean Detoeuf opened SPR-13420 and commented

It seems that getHeader(String) is also being called inside checkNotModified. This method is not in HttpServletResponse in Servlet 2.5. Here is the stacktrace I'm facing. Issue was introduced in 4.2.0 as we were previously in 4.1.7.

Using the following:

Java 7.0_11
Jonas 5.2.4 - Servlet 2.5
Spring 4.2.1.RELEASE

[ERROR] 2015-09-02 11:04:12,663 [TP-Processor15]  org.apache.juli.logging.DirectJDKLog:167 - Servlet.service() for servlet appServlet threw exception
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getHeader(Ljava/lang/String;)Ljava/lang/String;
        at org.springframework.web.context.request.ServletWebRequest.checkNotModified(ServletWebRequest.java:187) ~[spring-web-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:240) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) ~[javaee-api-5.2.4.jar:5.2.4]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.2.1.RELEASE.jar:4.2.1.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) ~[javaee-api-5.2.4.jar:5.2.4]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) ~[jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) ~[jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.ow2.jonas.web.tomcat6.CheckOpenResourcesValve.invoke(CheckOpenResourcesValve.java:73) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.ow2.jonas.web.tomcat6.tx.TransactionValve.invoke(TransactionValve.java:90) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.ow2.jonas.web.tomcat6.ResetAuthenticationValve.invoke(ResetAuthenticationValve.java:95) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) [jonas-web-container-tomcat-6.0-5.2.4-ipojo.jar:5.2.4]
        at java.lang.Thread.run(Thread.java:722) [na:1.7.0_11]

As of today, we're not able to switch to a servlet 3.0 compatible application server.


Affects: 4.2 GA, 4.2.1

Reference URL: #17976

Issue Links:

Activity

  1. spring-projects-issues commented on Sep 2, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Fixed for 4.2.2 now, simply assuming that those headers are not present in the response if we can't actually check them (on Servlet 2.5). Please give the upcoming 4.2.2.BUILD-SNAPSHOT a try to make sure that it actually works in your environment...

    We committed ourselves to tolerating Servlet 2.5 for the entire Spring 4.x line, despite our general Servlet 3.0+ focus, so thanks a lot for this feedback! Please note that we will require Servlet 3.0+ as of Spring Framework 5.0 (along with Java 8+).

    Juergen

  2. spring-projects-issues commented on Sep 2, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Jean Detoeuf commented

    Build snapshot 4.2.2 works as expected. Thank you for your reactiveness.

    Jean

  3. added
    type: bug
    in: web
    on Jan 11, 2019
  4. added this to the 4.2.2 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions