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

配置中有空数据导致微服务启动失败,是否可以捕获该异常 #3572

Closed
yanghao605 opened this issue Jan 10, 2023 · 8 comments

Comments

@yanghao605
Copy link
Contributor

yanghao605 commented Jan 10, 2023

微服务创建ConfigurationSpringInitializer对象时,由于空指针导致对象创建失败,目前来看应该是配置项中有空指针,但是无法判断到底是什么配置项,能不能捕获该异常,并显示导致空指针的配置项

@yanghao605 yanghao605 changed the title 配置中有空指针导致微服务启动失败,是否可以捕获该异常 配置中有空数据导致微服务启动失败,是否可以捕获该异常 Jan 10, 2023
@liubao68
Copy link
Contributor

能提供下重现问题的步骤吗?

@lbc97
Copy link
Contributor

lbc97 commented Jan 10, 2023

框架的版本号也提供一下吧

@yanghao605
Copy link
Contributor Author

2.6.0版本,暂时没有复现的方法

@fanjiwang1992
Copy link
Member

fanjiwang1992 commented Jan 11, 2023

这个问题,非常偶现,遇到的时候,重启服务没法无法解决,只能整个环境卸载重装,怀疑跟容器注入的env有关系,根据错误日志发现,多数据源配置在duplicateCseConfigToServicecomb处理的时候,ConcurrentHashMap会对key以及value做非空判断,否则会拋空指针,目前我们的处理方法是将duplicateCseConfigToServicecomb处理逻辑try catch处理了

代码:
public ConcurrentMapConfigurationExt(Map<String, Object> mapToCopy) {
super();
setDelimiterParsingDisabled(true);
map = new ConcurrentHashMap<String, Object>(mapToCopy);
}

java.util.concurrent.ConcurrentHashMap#putVal
image

@liubao68
Copy link
Contributor

能提供下错误堆栈吗?

@yanghao605
Copy link
Contributor Author

image

@liubao68 liubao68 added this to the 2.8.5 milestone Jan 13, 2023
@lbc97
Copy link
Contributor

lbc97 commented Jan 13, 2023

The microservice fails to be started due to empty data in the configuration. Can the exception be captured?

@liubao68
Copy link
Contributor

liubao68 commented Feb 2, 2023

fixed in 2.8.5

@liubao68 liubao68 closed this as completed Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants