更新时间:2025-06-23 GMT+08:00
分享

如何解决启动时MongoDB注入失败问题?

问题描述

在启动数据建模引擎运行SDK过程中,遇到MongoDB注入失败的问题。具体表现为Tomcat启动上下文时抛出异常,相关日志信息如下:

2024-08-22 10:48:11 [main] ERROR TomcatStarter:61 []- Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependenc******************** Error creating bean with name 'exaCacheFilterRegistration' defined in class path resource [com/huawei/it/rdm/configuration/AppConfiguration.class]: Unsatisfied dependenc********************method 'exaCacheFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependenc********************eating bean with name 'EXACacheFilter': Unsatisfied dependenc********************field 'aAb'; nested exception is org.springframework.beans.factory.UnsatisfiedDependenc********************eating bean with name 'EXACacheService': Unsatisfied dependenc********************field 'aej'; nested exception is org.springframework.beans.factory.UnsatisfiedDependenc********************eating bean with name 'xdmEXADefinitionLinkServiceImpl': Unsatisfied dependenc********************field 'MH'; nested exception is org.springframework.beans.factory.UnsatisfiedDependenc********************eating bean with name 'mongoDbServiceImpl': Unsatisfied dependenc********************field 'aHJ'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoData********************ss path resource [com/huawei/it/rdm/config/MongoDBConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.client.MongoData********************d 'mongoDbFactory' threw exception; nested exception is java.lang.IllegalArgumentException: The connection string is invalid. Connection strings must start with either 'mongodb://' or 'mongodb+srv://

可能原因

“application.properties”配置文件中的MongoDB连接配置不正确 。

处理方法

检查“application.properties”配置文件中的MongoDB连接配置,确保已关闭MongoDB连接配置。具体配置信息请参见MongoDB配置,在“application.properties”配置文件中的示例如下:

mongodb.init=false

相关文档