EL1007E: Property or field 'tenantId' cannot be found on null

Blade 未结 2 671

一、该问题的重现步骤是什么?

由于本地配置了多数据源,通过dynamic-datasource-spring-boot-starter进行数据源切换。其他使用正常。但是进行加载NoticeController相关业务处理。就出现这个Property or field 'tenantId' cannot be found on null 。

图片.png


2. 通过查看手册,开启数据库隔离配置之后

图片.png


二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

BladeX-Boot.2.8.1RELEASE

四、请提供详细的错误堆栈信息,这很重要。

出现如下问题

项目加载器启动中途失败,项目停止运行


***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springblade.core.tenant.config.TenantDataSourceConfiguration.dataSource(TenantDataSourceConfiguration.java:91)

The following method did not exist:

    com.baomidou.dynamic.datasource.DynamicRoutingDataSource.setProvider(Lcom/baomidou/dynamic/datasource/provider/DynamicDataSourceProvider;)V

The method's class, com.baomidou.dynamic.datasource.DynamicRoutingDataSource, is available from the following locations:

    jar:file:/F:/Repository/Maven_Repository/com/baomidou/dynamic-datasource-spring-boot-starter/3.5.0/dynamic-datasource-spring-boot-starter-3.5.0.jar!/com/baomidou/dynamic/datasource/DynamicRoutingDataSource.class

It was loaded from the following location:

    file:/F:/Repository/Maven_Repository/com/baomidou/dynamic-datasource-spring-boot-starter/3.5.0/dynamic-datasource-spring-boot-starter-3.5.0.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.baomidou.dynamic.datasource.DynamicRoutingDataSource

五、若有更多详细信息,请在下面提供。

2条回答
  •  gtfhao
    gtfhao (楼主)
    2022-09-14 10:23


    @TenantDS在controller里把这注解注释掉就可以了

提交回复