RpcContext.getContext().getAttachment(RootContext.KEY_XID) is null
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Ⅰ. Issue Description
dubbo远程调用,hessian协议,在TransactionPropagationFilter.invoke方法中getAttachment(RootContext.KEY_XID),这个key是大写的,但是RpcContext#attachments中的key是小写的,导致此处无法获取获取传递过来的全局事务id。
导致attachments中的key为小写是因为: Http11InputBuffer#parseHeader中对用户添加的head name都置为了小写。 然后org.apache.dubbo.rpc.protocol.hessian.HessianProtocol.HessianHandler#handle直接从request取参数,代码如下: // 直接从request head里取出传递的参数 Enumeration<String> enumeration = request.getHeaderNames(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); if (key.startsWith(Constants.DEFAULT_EXCHANGER)) { RpcContext.getContext().setAttachment(key.substring(Constants.DEFAULT_EXCHANGER.length()), request.getHeader(key)); } } // …
请问这个怎么能解决?
Ⅱ. Describe what happened
If there is an exception, please attach the exception trace:
Just paste your stack trace here!
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
服务提供方用hessian协议暴露服务即可: <dubbo:protocol name=“hessian” server=“servlet” port=“${server.port}”/>
Ⅴ. Anything else we need to know?
Ⅵ. Environment:
- JDK version :1.8
- OS : win10_64
- spring boot : 2.1.8.RELEASE
- apache dubbo : 2.7.0
- hessian : 4.0.38
- seata-all : 0.8.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
@slievrly nginx default auto filter
_
header, back end server may be get the header is null, otherwise nginx need configurationunderscores_in_headers on;
inhttp {...}
, I suggest the header update totx-xid
@Daidalose I understand that.It may cause by the similar problem.So i refer that issue here.