Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seata启动指定nacos.client.contextPath变量在nacos作为注册中心和配置中心未生效 #5110

Closed
kutouziUk opened this issue Nov 30, 2022 · 8 comments · Fixed by #5111
Assignees

Comments

@kutouziUk
Copy link

kutouziUk commented Nov 30, 2022

在ParamUtil中,指定了nacos的路由
image
在nacos作为配置中心和配置中心时Properties属性中并没有该属性,导致SecurityProxy初始化时,还是使用的/nacos而不是启动时指定的变量
image
导致连接nacos失败
image

@kutouziUk
Copy link
Author

个人觉得应该在NacosConfiguration#getConfigProperties方法和NacosRegistryServiceImpl#getNamingProperties方法加上
if(ParamUtil.getDefaultContextPath() != null) { properties.setProperty(CONTEXT_PATH,ParamUtil.getDefaultContextPath()); }
的判断
image

@funky-eyes
Copy link
Contributor

ParamUtil这个类是属于nacos的吗,如果是应该是由nacos侧决定吗?建议反馈至nacos

@kutouziUk
Copy link
Author

ParamUtil这个类是属于nacos的吗,如果是应该是由nacos侧决定吗?建议反馈至nacos

seata中的源代码

@funky-eyes
Copy link
Contributor

image
image

@kutouziUk
Copy link
Author

确实不是seata中的是nacos-client中的,seata启动如何指定nacos的context-path,源码里面好像没有这个配置属性

@xingfudeshi
Copy link
Member

This issue may be the same as this issue #5012
I'll will fix it.

@funky-eyes
Copy link
Contributor

与nacos社区沟通后,此参数由nacos读取和使用,此参数在应用启动时通过-D注入启动变量中,如果有问题请反馈至nacos社区

@funky-eyes funky-eyes reopened this Dec 1, 2022
@funky-eyes
Copy link
Contributor

个人觉得应该在NacosConfiguration#getConfigProperties方法和NacosRegistryServiceImpl#getNamingProperties方法加上 if(ParamUtil.getDefaultContextPath() != null) { properties.setProperty(CONTEXT_PATH,ParamUtil.getDefaultContextPath()); } 的判断 image

这个截图里画红框的其实应该写在nacos内侧统一参数作用,nacos.client.contextPath和contextPath映射为一个配置项,且读取配置存在优先级。外侧由集成方去传,只传contextPath。
Seata集成侧后续会开放contextPath的传参,而配置的映射和优先级读取应该提个issue给nacos,这样在Seata侧即便用低版本的Seata,只要改为Nacos高版本,使用一个-D参数就能支持。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants