Hi

We are upgrading from Camel 2.24.2 to 4.21.0(4.22.0 has the same issue).  We 
are also moving from Java 11 to Java 25, and we are moving from Tomcat 9 to 
Tomcat 11 too.

We have a service(single war) that exposes Soap and Rest endpoints, and runs in 
Tomcat.

Our web.xml is configured to use CamelHttpTransportServlet async.

After upgrading, if Rest is configured to use servlet, and if our Rest endpoint 
receives a couple of requests close together we get this stack trace.

17-Sept-2026 14:23:25.794|ERROR|:|CamelHttpTransportServlet:431 Error 
processing request
java.lang.IllegalStateException: The response object has been recycled and is 
no longer associated with this facade
        at 
org.apache.catalina.connector.ResponseFacade.checkFacade(ResponseFacade.java:427)
        at 
org.apache.catalina.connector.ResponseFacade.isCommitted(ResponseFacade.java:190)
        at 
org.apache.catalina.connector.ResponseFacade.setStatus(ResponseFacade.java:360)
        at 
org.apache.camel.http.common.DefaultHttpBinding.doWriteResponse(DefaultHttpBinding.java:432)
        at 
org.apache.camel.http.common.DefaultHttpBinding.writeResponse(DefaultHttpBinding.java:381)
        at 
org.apache.camel.http.common.CamelServlet.afterProcess(CamelServlet.java:419)
        at 
org.apache.camel.http.common.CamelServlet.lambda$tryAsyncProcess$0(CamelServlet.java:378)
        at 
java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:884)
        at 
java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:862)
        at 
java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:531)
        at 
java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2206)
        at 
org.apache.camel.support.AsyncCallbackToCompletableFutureAdapter.done(AsyncCallbackToCompletableFutureAdapter.java:53)
        at org.apache.camel.AsyncCallback.run(AsyncCallback.java:46)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:202)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:192)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:169)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:143)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor.schedule(DefaultReactiveExecutor.java:54)
        at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.lambda$doRun$0(RedeliveryErrorHandler.java:1112)
        at 
org.apache.camel.component.cxf.jaxws.CxfClientCallback.handleResponse(CxfClientCallback.java:75)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:949)
        at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1762)
        at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1238)
        at 
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:414)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
        at 
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:347)
        at java.base/java.lang.Thread.run(Thread.java:1474)


A single request works fine.  If Rest is configured to use Jetty it doesnt 
error.

As part of processing the rest call, we make Soap calls to other services.  
Without the Soap call it also works fine.

If I change the CamelHttpTransportServlet to not be async, or set forceAwait to 
be true, then the stack trace doesnt occur, but the return from the Rest call 
has a Content-Type of XML, and exposes more information than I would like about 
the internal workings of the service(Note using Jetty has the same effect).  
See below for example response

HTTP/1.1 200
accept-encoding: gzip,deflate
user-agent: Apache-HttpClient/4.5.5 (Java/17.0.12)
ResponseContext: org.apache.cxf.message.Message.PROTOCOL_HEADERS={Accept=[*/*], 
accept-encoding=[gzip,deflate], Content-Length=[249], 
content-type=[text/xml;charset=UTF-8], date=[Thu, 17 Sep 2026 14:03:43 GMT], 
gemsessionid=[49b82c67-0674-4cf1-85db-c8ab72bd8c72], host=[localhost:8888], 
includetaskswithnopermissiontoperform=[true], 
SOAPAction=["CamelRestServletIssueService"], 
user-agent=[Apache-HttpClient/4.5.5 (Java/17.0.12)]}
ResponseContext: org.apache.cxf.transport.Conduit=conduit: class 
org.apache.cxf.transport.http.HttpClientHTTPConduit238686806target: 
http://localhost:8888/CamelRestServletIssueService/example
ResponseContext: jakarta.xml.ws.http.response.code=null
ResponseContext: org.apache.cxf.service.model.MessageInfo=[MessageInfo OUTPUT: 
{http://example.com/camelrestservletissueservice}CamelRestServletIssueServiceResponse]
ResponseContext: 
jakarta.xml.ws.wsdl.interface={http://example.com/camelrestservletissueservice}CamelRestServletIssueServicePort
ResponseContext: 
org.apache.cxf.binding.soap.SoapVersion=org.apache.cxf.binding.soap.Soap11@35b6d490
ResponseContext: envelope.events=[[Stax Event #13]]
ResponseContext: org.apache.cxf.headers.Header.list=[]
ResponseContext: 
jakarta.xml.ws.wsdl.service={http://example.com/camelrestservletissueservice}CamelRestServletIssueServicePortService
ResponseContext: schema-validation-enabled=NONE
ResponseContext: body.events=[]
ResponseContext: org.apache.cxf.ws.policy.AssertionInfoMap={}
ResponseContext: org.apache.cxf.client=true
ResponseContext: envelope.prefix=soap
ResponseContext: 
jakarta.xml.ws.wsdl.operation={http://example.com/camelrestservletissueservice}CamelRestServletIssueService
ResponseContext: 
jakarta.xml.ws.wsdl.port={http://example.com/camelrestservletissueservice}CamelRestServletIssueServicePortPort
ResponseContext: 
jakarta.xml.ws.wsdl.description=http://localhost:8888/CamelRestServletIssueService/example?wsdl
ResponseContext: org.apache.cxf.message.Message.ENCODING=UTF-8
ResponseContext: org.apache.cxf.message.inbound=true
ResponseContext: org.apache.cxf.message.Message.RESPONSE_CODE=200
ResponseContext: Content-Type=text/xml;charset=UTF-8
ResponseContext: body.prefix=soap
Accept: */*
SOAPAction: CamelRestServletIssueService
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 17 Sep 2026 14:03:45 GMT
Keep-Alive: timeout=20
Connection: keep-alive

{"example": "Output"}


I have attached a zip containing two maven projects to try to show the 
issue(when both projects are running in tomcat just put this address in the 
browser/SoapUI or equivalent, 
http://host:port/CamelRestServletIssue/rest/example).  Although I can reproduce 
the issue with the stack trace when the CamelRestServletIssue service calls a 
Soap service from our project, I cant provide that Soap service, so I have 
provided CamelRestServletIssueService as a service thats called, and the stack 
trace doesnt occur using that(even though there is nothing obvious as to why).  
What does happen in that instance though, is as soon as it has a return from 
the Soap service it returns to client who called the rest service without 
running the code in the route after(the code runs after it returns to the 
client).

Again if I change the CamelHttpTransportServlet to not be async, or set 
forceAwait to be true it works, but the return from the Rest call has a 
Content-Type of XML, and exposes more information than I would like about the 
internal workings of the service as above.

If forceAwait has to be true in 4.21.0 thats fine, but the mimeType being Xml, 
and extra data in the response is an issue for us.

Any ideas?


This email is sent on behalf of NEC Software Solutions UK Limited and its 
associated companies (together "NEC Software Solutions") and is strictly 
confidential and intended solely for the addressee(s). Full details of those 
companies can be found at https://www.necsws.com/group-company-details/ If you 
are not the intended recipient of this email you must: (i) not disclose, copy 
or distribute its contents to any other person nor use its contents in any way 
or you may be acting unlawfully; (ii) contact NEC Software Solutions 
immediately on +44(0)1442 768445 quoting the name of the sender and the 
addressee then delete it from your system. NEC Software Solutions has taken 
reasonable precautions to ensure that no viruses are contained in this email, 
but does not accept any responsibility once this email has been transmitted. 
You should scan attachments (if any) for viruses.

<<attachment: CamelRestIssue.zip>>

Reply via email to