apache / apache/servicecomb-java-chassis

微服务启动失败 -- NullPointer问题

Ouverte
#4,013 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
1.9k
Forks
814
Merge moyen
8 j 23 h
PR mergées (30 j)
1

Description

2.6.0版本,微服务在启动的时候,偶现微服务启动失败,错误日志中显示是由空指针引起的
错误日志如下
```
[2023-11-02 18:38:10.376+08:00] [INFO] [AuditLogReportTask]-[] [] | o.a.s.f.common.utils.SPIServiceUtils Found SPI service org.apache.servicecomb.core.ConsumerProvider, count=0.
[2023-11-02 18:38:10.375+08:00] [INFO] [main]-[] [] | c.h.g.notice.config.LogLevelMonitor change loglevel to [DEBUG] end
[2023-11-02 18:38:10.378+08:00] [INFO] [main]-[] [] | c.h.g.notice.config.LogLevelMonitor start to rollBack loglevel
Nov 02, 2023 6:38:12 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [101] milliseconds.
[2023-11-02 18:38:12.973+08:00] [WARN] [AuditLogReportTask]-[] [] | com.huawei.gts.operlog.LogReportTask The current registration for CSE service has not been completed, cse status: DOWN
[2023-11-02 18:38:16.120+08:00] [ERROR] [main]-[] [] | o.s.boot.SpringApplication Application run failed
java.lang.NullPointerException:
at org.apache.servicecomb.core.CseApplicationListener.onApplicationEvent(CseApplicationListener.java:90)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
at org.springframework.boot.context.event.EventPublishingRunListener.ready(EventPublishingRunListener.java:114)
at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:82)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
at org.springframework.boot.SpringApplicationRunListeners.ready(SpringApplicationRunListeners.java:82)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
at com.huawei.gts.notice.NoticeServiceApplication.main(NoticeServiceApplication.java:65)
```
单纯从代码中看,是在CSEApplicationListener中的 scbEngine.getProducerProviderManager().getProducerProviderList()可能出现了空指针,请问这块是否可以做一下加固?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par lire CseApplicationListener.java à la ligne 90 et suivez le chemin de démarrage indiqué dans la stack trace, en particulier autour de l’état CSE DOWN journalisé. C’est terminé lorsque le chemin de démarrage du microservice n’échoue plus avec cette NullPointerException et que l’état null suspecté est couvert par une vérification.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, spring-boot
Domaine
backend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.