Java Mule ESB不适用于cookie
我使用mule esb 3.7.0 我有一个应用程序A,它向mule esb发送http请求,mule esb将其转发给应用程序B。应用程序B将响应发送回mule esb,而mule esb将其发送回应用程序A。一切正常 然后有一天,应用程序B发送带有cookie的http响应(JSESSIONID,但这并不重要),应用程序a抛出超时异常。我调试了mule esb,发现了这个Java Mule ESB不适用于cookie,java,http,mule,Java,Http,Mule,我使用mule esb 3.7.0 我有一个应用程序A,它向mule esb发送http请求,mule esb将其转发给应用程序B。应用程序B将响应发送回mule esb,而mule esb将其发送回应用程序A。一切正常 然后有一天,应用程序B发送带有cookie的http响应(JSESSIONID,但这并不重要),应用程序a抛出超时异常。我调试了mule esb,发现了这个 org.mule.transport.http.transformers.MuleMessageToHttpRespon
org.mule.transport.http.transformers.MuleMessageToHttpResponse->
protected HttpResponse createResponse(Object src, String encoding, MuleMessage msg) throws IOException, TransformerException
这种方法失败了。第243行
for (String headerName : headerNames) {
if (HttpConstants.HEADER_COOKIE_SET.equals(headerName))
{
// TODO This have to be improved. We shouldn't have to look in all
// scopes
Object cookiesObject = msg.getInvocationProperty(headerName);
if (cookiesObject == null)
{
cookiesObject = msg.getOutboundProperty(headerName);
}
if (cookiesObject == null)
{
cookiesObject = msg.getInboundProperty(headerName);
}
if (cookiesObject == null)
{
continue;
}
if (!(cookiesObject instanceof Cookie[]))
{
response.addHeader(new Header(headerName, cookiesObject.toString()));
}
else
{
Cookie[] arrayOfCookies = CookieHelper.asArrayOfCookies(cookiesObject);
for (Cookie cookie : arrayOfCookies)
{
/////////// THIS ONE FAILS
response.addHeader(new Header(headerName,
CookieHelper.formatCookieForASetCookieHeader(cookie)));
}
}
}
else
{
Object value = msg.getOutboundProperty(headerName);
if (value == null)
{
value = msg.getInvocationProperty(headerName);
}
if (value != null)
{
response.setHeader(new Header(headerName, value.toString()));
}
}
}
org.mule.transport.http.CookieHelper
有编译错误。
一个类似的问题(不是重复的,因为我有一个不同版本的mule)
我也读过这个
事实证明,问题在于库。我们使用SpringBoot,它有依赖项,其中一个覆盖了coyote的版本
提供的组:'org.apache.tomcat',名称:'coyote',版本:'6.0.44'
对于SpringBoot,它使用嵌入式tomcat内核
编译组:'org.apache.tomcat.embed',名称:'tomcat embed core',版本:'8.0.28'
org.apache.tomcat.util.http.ServerCookie.appendCookieValue(Ljava/lang/StringBuffer;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZ)V
java.lang.NoSuchMethodError: org.apache.tomcat.util.http.ServerCookie.appendCookieValue(Ljava/lang/StringBuffer;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZZ)V
at org.mule.transport.http.CookieHelper.formatCookieForASetCookieHeader(CookieHelper.java:319)
at org.mule.transport.http.transformers.MuleMessageToHttpResponse.createResponse(MuleMessageToHttpResponse.java:272)
at org.mule.transport.http.transformers.MuleMessageToHttpResponse.transformMessage(MuleMessageToHttpResponse.java:109)
at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:141)
at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:89)
at org.mule.DefaultMuleMessage.transformMessage(DefaultMuleMessage.java:1602)
at org.mule.DefaultMuleMessage.applyAllTransformers(DefaultMuleMessage.java:1509)
at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1487)
at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1470)
at org.mule.transport.AbstractMessageReceiver.applyResponseTransformers(AbstractMessageReceiver.java:260)
at org.mule.transport.AbstractMessageReceiver.routeEvent(AbstractMessageReceiver.java:532)
at org.mule.transport.AbstractTransportMessageProcessTemplate.routeEvent(AbstractTransportMessageProcessTemplate.java:72)
at org.mule.execution.FlowProcessingPhase$1$1.process(FlowProcessingPhase.java:76)
at org.mule.execution.FlowProcessingPhase$1$1.process(FlowProcessingPhase.java:63)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:110)
at org.mule.execution.FlowProcessingPhase$1.run(FlowProcessingPhase.java:62)
at org.mule.transport.TrackingWorkManager$TrackeableWork.run(TrackingWorkManager.java:267)
at org.mule.work.WorkerContext.run(WorkerContext.java:286)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)