当前位置: 首页 > 知识库问答 >
问题:

创建名为springApplicationAdminRegistrar的bean时出错

邢飞鸿
2023-03-14

在将project从Spring Boot版本从1.2.3.release迁移到1.3.0.release之后,我已经开始得到以下异常。

创建类路径资源[org/springframework/boot/autoconfigure/admin/springapplicationadminjmxautoconfiguration.class]中定义的名为'Spring ApplicationAdminRegistrar'的bean时出错:调用init方法失败;嵌套异常是javax.management.instancealreadyexistsexception:org.springframework.boot:type=admin,name=springapplication

WARN  o.s.c.a.AnnotationConfigApplicationContext:545 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Admin,name=SpringApplication
INFO  o.s.j.e.a.AnnotationMBeanExporter:449 - Unregistering JMX-exposed beans on shutdown
WARN  o.s.b.f.s.DefaultListableBeanFactory:1480 - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userManagementDAO' defined in file [${PATH_TO_PROJECT}\target\classes\com\mycom\myproject\mappers\UserManagementDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'getSqlSessionFactory' defined in class path resource [com/mycom/myproject/config/DAOConfig.class]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSqlSessionFactory' defined in class path resource [com/mycom/myproject/config/DAOConfig.class]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
WARN  o.s.b.f.s.DefaultListableBeanFactory:1480 - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userManagementDAO' defined in file [${PATH_TO_PROJECT}\target\classes\com\mycom\myproject\mappers\UserManagementDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'getSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'getSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
WARN  o.s.b.f.s.DefaultListableBeanFactory:1480 - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userManagementDAO' defined in file [${PATH_TO_PROJECT}\target\classes\com\mycom\myproject\mappers\UserManagementDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'getSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'getSqlSessionFactory': Requested bean is currently in creation: Is there an unresolvable circular reference?
WARN  o.s.b.f.s.DefaultListableBeanFactory:1480 - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sampleDAO' defined in file [${PATH_TO_PROJECT}\target\classes\com\mycom\myproject\mappers\SampleDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'getSqlSessionFactory' defined in class path resource [com/mycom/myproject/config/DAOConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.mycom.myproject.entities.master.Method; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSqlSessionFactory' defined in class path resource [com/mycom/myproject/config/DAOConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.mycom.myproject.MyEntity
WARN  o.s.b.f.s.DefaultListableBeanFactory:1480 - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sampleDAO' defined in file [${PATH_TO_PROJECT}\target\classes\com\mycom\myproject\mappers\SampleDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'getSqlSessionFactory' defined in class path resource [com/mycom/myproject/config/DAOConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.mycom.myproject.entities.master.Method; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getSqlSessionFactory' defined in class path resource [com/mycom/myproject/config/DAOConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.mycom.myproject.MyEntity

有任何指针来调试这个问题吗?

共有1个答案

江阳冰
2023-03-14

Context是从代码中手动加载(Java代码)以获取bean,删除该代码解决了这个问题。然而,我的问题解决了,但仍然不确定它是如何与上一个版本的spring Boot一起工作的。

 类似资料:
  • 我有一个实体类InAppNotification。看起来像这样的java: 我使用JPA来处理数据库查询,这就是JPA接口的定义: 这是我application.properties的样子: 但是,当我试图在构建后通过运行 来打包应用程序时,我会遇到以下问题: 尝试调用不存在的方法。尝试从以下位置进行:javax.el.ELManager.getExpress sionWorks(ELManage

  • 我遵循本教程将消息发送到azure服务队列:https://docs.microsoft.com/en-us/azure/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus 到我现有的spring boot应用程序,但我得到以下错误: 用户类别: 控制器类: pom xml: 添加它

  • 我试图将弹性搜索集成到spring-boot应用程序中,但我得到了这个*创建名为“client”的bean时出错*异常,不确定是什么地方出了问题,因为我之前找不到任何类似的线索...非常感谢你为大家指路。这是mu elasticsearch配置: 这是我的主要应用程序: 我的pom.xml: 这是te异常跟踪:

  • 我有这些错误编译,我不知道我哪里错了,我只有这3个类

  • 我正在尝试在spring boot应用程序中使用SQLite。但是应用程序不能创建下面的bean。 org.springframework.boot.autocigure.orm.jpa.hibernatejaconfiguration 我该怎么办?我在这个站点上搜索了相关的问题,但是找不到一个合适的。 如下所示。 4.0.0 org.springframework.Boot spring-boo

  • 在我的Spring应用程序中,我有这些问题。有人能帮我吗? 我在pom.xml上添加了一些东西,但是应用程序没有启动,有很多错误。 启动应用程序上下文时出错。若要显示条件报告,请在启用“调试”的情况下重新运行应用程序。2019-01-26 14:58:17.003 错误 14580 --- [ 重新启动主屏幕] o.s.boot.Spring 应用程序: 应用程序运行失败