欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

Failedtoinstantiate[javax.activation.DataSource]com.alibaba.druid.pool.DruidDataSourcecannotbe

时间:2023-07-03

错误:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.activation.DataSource]: Factory method ‘getDruidDataSource’ threw exception; nested exception is java.lang.ClassCastException: com.alibaba.druid.pool.DruidDataSource cannot be cast to javax.activation.DataSource

导包错了
错误:import javax.activation.DataSource;
正确:import javax.sql.DataSource;

类似的错误:
导入了import com.mysql.jdbc.Connection;
正确应该是import java.sql.Connection;

参考:https://blog.csdn.net/YKbsmn/article/details/106799195

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。