dromara / lamp-cloud

lamp-cloud 支持jdk21、jdk17、jdk11、jdk8,ta基于 SpringCloud + SpringBoot 开发的微服务中后台快速开发平台,专注于多租户(SaaS架构)解决方案,亦可作为普通项目(非SaaS架构)的基础开发框架使用,目前已实现插拔式数据库隔离、SCHEMA隔离、字段隔离 等租户隔离方案。
http://tangyh.top
Apache License 2.0
5.5k stars 1.67k forks source link

启动OauthServerApplication服务异常,报:top.tangyh.basic.exception.BizException: 数据源初始化期间出现异常 #190

Closed shawnxiang0511 closed 2 years ago

shawnxiang0511 commented 2 years ago

版本信息:

JDK 版本(必填) : 1.8.0 源码版本(必填):4.11.0 lamp-cloud-pro-datasource-column MySQL(必填): 5.7.9 Nacos(必填):2.0.3

问题描述:

启动OauthServerApplication服务异常,报:top.tangyh.basic.exception.BizException: 数据源初始化期间出现异常 我是在前端租户维护中删除租户企业后,再在mysql的可视化的客户端navicat中删除相应的数据库后,启动OauthServerApplication服务异常了

报错截图

top.tangyh.basic.exception.BizException: 数据源初始化期间出现异常 at top.tangyh.lamp.tenant.service.impl.DynamicDataSourceServiceImpl.putDs(DynamicDataSourceServiceImpl.java:287) at top.tangyh.lamp.tenant.service.impl.DynamicDataSourceServiceImpl.lambda$addSystem$5(DynamicDataSourceServiceImpl.java:274) at java.util.ArrayList.forEach(ArrayList.java:1257) at top.tangyh.lamp.tenant.service.impl.DynamicDataSourceServiceImpl.addSystem(DynamicDataSourceServiceImpl.java:246) at top.tangyh.lamp.tenant.service.impl.DynamicDataSourceServiceImpl.lambda$loadSystemDataSource$3(DynamicDataSourceServiceImpl.java:168) at java.util.ArrayList.forEach(ArrayList.java:1257) at top.tangyh.lamp.tenant.service.impl.DynamicDataSourceServiceImpl.loadSystemDataSource(DynamicDataSourceServiceImpl.java:168) at top.tangyh.lamp.tenant.service.DatasourceInitDataSourceService.initDataSource(DatasourceInitDataSourceService.java:26) at top.tangyh.lamp.tenant.service.DatasourceInitDataSourceService$$FastClassBySpringCGLIB$$70291594.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) at top.tangyh.lamp.tenant.service.DatasourceInitDataSourceService$$EnhancerBySpringCGLIB$$fc4bdef.initDataSource() at top.tangyh.lamp.tenant.context.InitDatabaseOnStarted.onApplicationEvent(InitDatabaseOnStarted.java:27) at top.tangyh.lamp.tenant.context.InitDatabaseOnStarted.onApplicationEvent(InitDatabaseOnStarted.java:20) 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.started(EventPublishingRunListener.java:108) at org.springframework.boot.SpringApplicationRunListeners.lambda$started$5(SpringApplicationRunListeners.java:78) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120) at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114) at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:78) at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) at top.tangyh.lamp.OauthServerApplication.main(OauthServerApplication.java:39) Caused by: com.baomidou.dynamic.datasource.exception.ErrorCreateDataSourceException: druid create error at com.baomidou.dynamic.datasource.creator.DruidDataSourceCreator.doCreateDataSource(DruidDataSourceCreator.java:87) at com.baomidou.dynamic.datasource.creator.AbstractDataSourceCreator.createDataSource(AbstractDataSourceCreator.java:70) at top.tangyh.lamp.tenant.service.impl.DynamicDataSourceServiceImpl.putDs(DynamicDataSourceServiceImpl.java:282) ... 34 common frames omitted Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:898) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823) at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:448) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156) at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:787) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:251) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1659) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1723) at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:927) at com.baomidou.dynamic.datasource.creator.DruidDataSourceCreator.doCreateDataSource(DruidDataSourceCreator.java:85) ... 36 common frames omitted Caused by: com.mysql.cj.exceptions.CJException: Unknown database 'lamp_base_254171916854624256' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:848) at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:770) at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:738) at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:155) at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:472) at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:212) at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1433) at com.mysql.cj.NativeSession.connect(NativeSession.java:133) at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:842) ... 49 common frames omitted

重现步骤

  1. 访问了什么接口?
  2. 传递什么参数?
  3. 后端控制台报了什么错?
  4. 前端控制台报了什么错?

支持一下

如果该issue帮助了你, 麻烦给项目点个star, 并给当前issue回复一下 “👍” 或者 “已解决”.

zuihou commented 2 years ago

https://github.com/zuihou/lamp-cloud/issues/191