Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-19257

camel-jslt: Exception when using camel-jslt in Tomcat Servlet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.20.3, 4.0-M2
    • 3.20.4, 3.21.0, 4.0-M3, 4.0.0
    • None
    • None
    • Unknown

    Description

      When a JSLT transformation is used in a route which is called from a Tomcat Servlet in Spring Boot, an exception is thrown after the Exchange is completely processed and the response is being returned to the client:

      java.lang.IllegalStateException: getWriter() has already been called for this response
      at org.apache.catalina.connector.Response.getOutputStream(Response.java:552) ~[tomcat-embed-core-9.0.70.jar:9.0.70]
      at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:210) ~[tomcat-embed-core-9.0.70.jar:9.0.70]
      at org.apache.camel.http.common.DefaultHttpBinding.doWriteDirectResponse(DefaultHttpBinding.java:537) ~[camel-http-common-3.20.3.jar:3.20.3]
      at org.apache.camel.http.common.DefaultHttpBinding.doWriteResponse(DefaultHttpBinding.java:439) ~[camel-http-common-3.20.3.jar:3.20.3]
      at org.apache.camel.http.common.DefaultHttpBinding.writeResponse(DefaultHttpBinding.java:362) ~[camel-http-common-3.20.3.jar:3.20.3]
      at org.apache.camel.http.common.CamelServlet.afterProcess(CamelServlet.java:349) ~[camel-http-common-3.20.3.jar:3.20.3]

      This happens because the Response object is held in a header and getWriter() gets prematurely called when the headers are serialized in JsltEndpoint.extractVariables().

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jsz Jacek SzymaƄski
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: