问题描述
在启动我的 Spring Boot 应用程序时出错。这是堆栈跟踪,但我无法找到根本原因。我正在使用带有 spring 数据 jpa 的 spring boot 2.3.4。任何帮助表示赞赏。
{"timestamp": "12/21/2020 18:52:02:0871","class": "org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator","file": "JtaPlatformInitiator.java","level" : " INFO","line_number" : "52","url": "","ip_address": "","server_trace_id":"","message": HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform],"method": "initiateService","thread_name": "task-1"},{"timestamp": "12/21/2020 18:52:02:0872","class": "org.hibernate.query.spi.NamedQueryRepository","file": "NamedQueryRepository.java","level" : "DEBUG","line_number" : "151","message": Checking 0 named HQL queries,"method": "checkNamedQueries","line_number" : "167","message": Checking 0 named sql queries,{"timestamp": "12/21/2020 18:52:02:0891","class": "org.hibernate.internal.SessionFactoryRegistry","file": "SessionFactoryRegistry.java","message": Initializing SessionFactoryRegistry : org.hibernate.internal.SessionFactoryRegistry@263b5690,"method": "<init>","line_number" : "74","message": Registering SessionFactory: 64cd8993-8947-4c28-8a99-8717be785280 (<unnamed>),"method": "addSessionFactory","line_number" : "81","message": Not binding SessionFactory to JNDI,no JNDI name configured,{"timestamp": "12/21/2020 18:52:02:0896","class": "org.hibernate.internal.SessionFactoryImpl","file": "SessionFactoryImpl.java","line_number" : "771","message": HHH000031: Closing,"method": "close","thread_name": "restartedMain"},{"timestamp": "12/21/2020 18:52:02:0897","class": "org.hibernate.type.spi.TypeConfiguration$Scope","file": "TypeConfiguration.java","line_number" : "350","message": Un-scoping TypeConfiguration [org.hibernate.type.spi.TypeConfiguration$Scope@3fbaa2e9] from SessionFactory [org.hibernate.internal.SessionFactoryImpl@1741883a],"method": "unsetSessionFactory",{"timestamp": "12/21/2020 18:52:02:0902","class": "org.hibernate.service.internal.AbstractServiceRegistryImpl","file": "AbstractServiceRegistryImpl.java","line_number" : "419","message": Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries,"method": "deRegisterChild","class": "org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl","file": "BootstrapServiceRegistryImpl.java","line_number" : "295","message": Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries,Exception in thread "task-2" org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'delegatingApplicationListener': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a beanfactory in a destroy method implementation!)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
DefaultSingletonBeanRegistry.java:220
at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:322)
Abstractbeanfactory.java:322
at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:207)
Abstractbeanfactory.java:207
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245)
AbstractApplicationEventMulticaster.java:245
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197)
AbstractApplicationEventMulticaster.java:197
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134)
SimpleApplicationEventMulticaster.java:134
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
AbstractApplicationContext.java:404
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
AbstractApplicationContext.java:361
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.publishEventIfrequired(DataSourceInitializedPublisher.java:99)
DataSourceInitializedPublisher.java:99
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.access$100(DataSourceInitializedPublisher.java:50)
DataSourceInitializedPublisher.java:50
at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher$DataSourceSchemaCreatedPublisher.lambda$postProcessEntityManagerFactory$0(DataSourceInitializedPublisher.java:200)
DataSourceInitializedPublisher.java:200
{"timestamp": "12/21/2020 18:52:02:0905","class": "com.zaxxer.hikari.HikariDataSource","file": "HikariDataSource.java","message": HikariPool-1 - Shutdown initiated...,{"timestamp": "12/21/2020 18:52:02:0906","class": "com.zaxxer.hikari.pool.HikariPool","file": "HikariPool.java","line_number" : "421","message": HikariPool-1 - Before shutdown stats (total=1,active=0,idle=1,waiting=0),"method": "logPoolState",at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
解决方法
设置JAVA_HOME路径并更新JDK版本。之后重新启动您的服务器,它应该可以正常工作! 如果这不起作用,请检查您有多少个 tomcat 实例。如果您有多个,请关闭它们。 如果您使用错误,它也可能是@Transactional 注释的问题,您可以在此处查看更多详细信息->http://www.javablog.fr/spring-transaction-visibility-proxy-propagation-required-and -requires_new.html