alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.26k stars 12.84k forks source link

使用了额外的数据源后 nacos启动提示 Caused by: java.lang.IllegalStateException: No DataSource set #12638

Closed silent-night-no-trace closed 1 month ago

silent-night-no-trace commented 1 month ago

Describe the bug A clear and concise description of what the bug is. 使用了额外的数据源后 nacos启动提示 Caused by: java.lang.IllegalStateException: No DataSource set

Caused by: java.lang.IllegalStateException: No DataSource set at org.springframework.util.Assert.state(Assert.java:76) at org.springframework.jdbc.support.JdbcAccessor.obtainDataSource(JdbcAccessor.java:86) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:378) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:466) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:476) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:509) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:516) at com.alibaba.nacos.config.server.service.repository.extrnal.ExternalConfigInfoPersistServiceImpl.findConfigMaxId(ExternalConfigInfoPersistServiceImpl.java:676) at com.alibaba.nacos.config.server.service.repository.extrnal.ExternalConfigInfoPersistServiceImpl$$FastClassBySpringCGLIB$$a645f555.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:792) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:762) at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:762) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:762) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:707) at com.alibaba.nacos.config.server.service.repository.extrnal.ExternalConfigInfoPersistServiceImpl$$EnhancerBySpringCGLIB$$c1f7f6ec.findConfigMaxId() at com.alibaba.nacos.config.server.service.dump.processor.DumpAllProcessor.process(DumpAllProcessor.java:62) at com.alibaba.nacos.config.server.service.dump.DumpService.dumpAllConfigInfoOnStartup(DumpService.java:332) at com.alibaba.nacos.config.server.service.dump.DumpService.dumpOperate(DumpService.java:263) ... 48 common frames omitted

Expected behavior A clear and concise description of what you expected to happen. 正常启动

Actually behavior A clear and concise description of what you actually to happen. 启动报错

How to Reproduce 配置额外的数据源 并启动nacos 即可遇到此错误

Desktop (please complete the following information): nacos 2.4.2 Additional context Add any other context about the problem here.

silent-night-no-trace commented 1 month ago

如果有空的话 联系下我 我们讨论下方案 我提个pr

KomachiSion commented 1 month ago

提什么PR? 这个提示就是无法连接数据库,无法构建DataSource,请查询日志上文以及其他日志文件,查看为什么无法连接数据库

zhdd15 commented 1 month ago

配置文件修改成使用mysql数据源后,也碰到同样的报错,最后发现是没有执行/conf/mysql-schema.sql脚本,导致找不到表