Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.filter.logging.Log4j2Filter

Posted chsoul

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.filter.logging.Log4j2Filter相关的知识,希望对你有一定的参考价值。

查看github的解决方案:https://github.com/alibaba/druid/issues/2942

你安装的应该是低版本的druid没有这个类,升级到新版;指定druid-spring-boot-starter但没指定druid也可能出现这个错误

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>1.1.10</version>
</dependency>

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid-spring-boot-starter</artifactId>
    <version>1.1.10</version>
</dependency>

添加druid starter包的同时,也要添加druid的包即可解决报错。

此外对于validation-query属性,不同的数据库值也不一样。

DataBase validation-query
hsqldb select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
Oracle select 1 from dual
DB2 select 1 from sysibm.sysdummy1
mysql select 1
Microsoft SqlServer select 1
postgresql select version()
ingres select 1
derby select 1
H2 select 1

以上是关于Caused by: java.lang.ClassNotFoundException: com.alibaba.druid.filter.logging.Log4j2Filter的主要内容,如果未能解决你的问题,请参考以下文章

Mathematical Problems Caused by CCD

Caused by SSLError

Caused by: java.lang.NoClassDefFoundError:

caused by a circular import.

异常Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationExcep

Caused by org hibernate DuplicateMappingException Duplicat