为什么部署数据建模引擎运行SDK时提示:该表在数据库中不存在?
问题描述
在启动数据建模引擎运行SDK过程中,日志文件中出现类似如下错误信息:
2024-08-22 14:14:59 [main] ERROR SqlExceptionHelper:142 []- (conn=267804) Table 'hwsdk.rdm_business_code_seq' doesn't exist 2024-08-22 14:14:59 [main] WARN MethodCostAop:91 []- Class: com.huawei.it.rdm.service.impl.typedefinition.XdmTypeDefinitionSyncServiceImpl jZ method used time: 444 ms 2024-08-22 14:14:59 [main] ERROR LoadAgentSpringApplicationRunListener:664 []- failed to initializeTypeDefinition type . exception: com.huawei.iit.sdk.co************************eption: at com.huawei.iit.sdk.common.exception.ExceptionHandleUtil.c(ExceptionHandleUtil.java:133) ~ [microserviceTemplate.app-1.0.0-SNAPSHOT-small.jar:?] at com.huawei.it.rdm.configuration.LoadAgentSpringApplicationRunListener.n(LoadAgentSpringApplicationRunListener.java:665) ~[microserviceTemplate.app-1.0.0-SNAPSHOT-small.jar:?] at com.huawei.it.rdm.configuration.LoadAgentSpringApplicationRunListener.c(LoadAgentSpringApplicationRunListener.java:361) ~[microserviceTemplate.app-1.0.0-SNAPSHOT-small.jar:?] at com.huawei.it.rdm.configuration.LoadAgentSpringApplicationRunListener.a(LoadAgentSpringApplicationRunListener.java:235) ~[microserviceTemplate.app-1.0.0-SNAPSHOT-small.jar:?] at com.huawei.it.rdm.configuration.LoadAgentSpringApplicationRunListener.ready(LoadAgentSpringApplicationRunListener.java:193) ~[microserviceTemplate.app-1.0.0-SNAPSHOT-small.jar:?] at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:82) ~[spring-boot-2.7.18.jar:2.7.18] at java.util.ArrayList.forEach(ArrayList.java:1540) [?:?] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120) [spring-boot-2.7.18.jar:2.7.18] at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114) [spring-boot-2.7.18.jar:2.7.18] at org.springframework.boot.SpringApplicationRunListeners.ready(SpringApplicationRunListeners.java:82) [spring-boot-2.7.18.jar:2.7.18] at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) [spring-boot-2.7.18.jar:2.7.18] at com.huawei.microservice.rdm.RdmApplication.main(RdmApplication.java:51) [microserviceTemplate.app-1.0.0-SNAPSHOT-small.jar:?]
可能原因
MySQL数据库配置文件中的大小写不敏感配置不正确 。
处理方法
SHOW VARIABLES LIKE 'lower_case_table_names';
- 如果返回的“lower_case_table_names”值为“1”,表示数据库配置为大小写不敏感。
- 如果返回的“lower_case_table_names”值不为“1”,表示数据库配置为大小写敏感。
当返回值不为1时,需要在MySQL数据库的配置文件(my.cnf或my.ini)中,添加以下配置项,并重启MySQL服务以生效。
lower_case_table_names=1;