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

项目启动失败,报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dtpWechatNotifier' defined in URL #497

Open
nutshell999 opened this issue Nov 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nutshell999
Copy link

首先感谢您使用 DynamicTp,如果使用过程中有任何问题,请按照下述模板反馈问题,请使用 Markdown 语法

版本信息

  • Jdk版本:1.8
  • SpringBoot版本:2.5.6
  • DynamicTp版本:1.0.2
  • 配置中心类型:apollo
  • 配置中心版本:2.1.0

问题描述

报错堆栈如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dtpWechatNotifier' defined in URL [jar:file:/C:/Users/Xbai/.m2/repository/io/github/lyh200/dynamic-tp-core/1.0.2/dynamic-tp-core-1.0.2.jar!/com/dtp/core/notify/wechat/DtpWechatNotifier.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.dtp.core.notify.wechat.DtpWechatNotifier]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1232) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.12.jar:5.3.12]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.12.jar:5.3.12]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.6.jar:2.5.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.6.jar:2.5.6]
at com.java3y.austin.web.AustinApplication.main(AustinApplication.java:31) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.dtp.core.notify.wechat.DtpWechatNotifier]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.12.jar:5.3.12]
... 17 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.dtp.common.ApplicationContextHolder.getEnvironment(ApplicationContextHolder.java:42) ~[dynamic-tp-common-1.0.2.jar:1.0.2]
at com.dtp.core.notify.AbstractNotifier.init(AbstractNotifier.java:52) ~[dynamic-tp-core-1.0.2.jar:1.0.2]
at com.dtp.core.notify.AbstractNotifier.(AbstractNotifier.java:47) ~[dynamic-tp-core-1.0.2.jar:1.0.2]
at com.dtp.core.notify.wechat.AbstractWechatNotifier.(AbstractWechatNotifier.java:21) ~[dynamic-tp-core-1.0.2.jar:1.0.2]
at com.dtp.core.notify.wechat.DtpWechatNotifier.(DtpWechatNotifier.java:29) ~[dynamic-tp-core-1.0.2.jar:1.0.2]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_311]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_311]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_311]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_311]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.12.jar:5.3.12]
... 19 common frames omitted

dtpWechatNotifier初始化失败了,看堆栈主要是ApplicationContextHolder.getEnvironment拿不到上下文,为空指针,能否帮忙看下这个问题。

@nutshell999 nutshell999 added the bug Something isn't working label Nov 1, 2024
@yanhom1314
Copy link
Collaborator

这版本老旧了,用最新的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants