SonarQube执行代码扫描失败,Can not execute Findbugs

SonarQube 版本 9.2.4

SonarQube执行代码扫描失败,报错如下

remote: INFO: Sensor FindBugs Sensor [findbugs]        
remote: INFO: Findbugs plugin version: 4.2.6        
remote: INFO: JavaResourceLocator.binaryDirs() not available before SonarQube 9.8        
remote: INFO: JavaResourceLocator.testClasspath() not available before SonarQube 9.8        
remote: WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your (sub)project (/var/opt/gitlab/git-data/repositories/@hashed/d6/06/d6061bbee6cf13bd73765faaea7cdd0af1323e4b125342ac346047f7c4bda1fc.git/tmp).        
remote: WARN: Property 'sonar.java.binaries' is not declared as multi-values/property set but was read using 'getStringArray' method. The SonarQube plugin declaring this property should be updated.        
remote: INFO: ------------------------------------------------------------
### 解决 'can not execute because can not find cache of TableInfo for entity' 错误 当遇到 `can not execute. because can not find cache of TableInfo for entity` 的错误时,这通常意味着框架无法找到实体对应的表结构信息缓存。以下是几种可能的原因及解决方案: #### 1. 实体类未注册到ORM映射配置文件中 如果实体类没有被正确地注册到ORM框架的映射配置文件里,则不会创建相应的元数据并存储于内存中的缓存区域。 为了确保所有的实体都被加载,在应用程序启动阶段应当确认所有必要的包路径已经被扫描到了,并且这些包下的实体都已加入到持久化单元内[^1]。 ```java @EntityScan(basePackages = "com.example.entities") // Spring Data JPA Example @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } ``` #### 2. 缓存机制失效或不一致 某些情况下,由于程序异常终止或其他原因可能导致缓存状态变得不稳定甚至损坏。尝试清理应用服务器的工作目录以及重启服务来重建新的会话环境可能会有所帮助。 另外也可以考虑禁用二级缓存功能来进行排查测试,通过设置相关属性关闭它: 对于Hibernate来说可以在application.properties中添加如下配置项: ```properties spring.jpa.properties.hibernate.cache.use_second_level_cache=false ``` #### 3. 数据库连接池参数不当 数据库连接超时、最大活跃数不足等问题也可能间接影响到TableInfo对象能否正常获取。调整合适的DBCP(DataSource Connection Pool) 参数有助于提高系统的稳定性和性能表现。 例如在Spring Boot项目中可以这样修改datasource的相关设定: ```yaml spring: datasource: hikari: maximum-pool-size: 20 minimum-idle: 5 idle-timeout: 30000 connection-timeout: 20000 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值