org.springframework.beans.factory.BeanCreationException && java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.hmall.common.advice.CommonExceptionAdvice] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2437c6dc]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.hmall.common.advice.CommonExceptionAdvice] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@2437c6dc]
原因:
在全局异常处理器类上加上@ConditionalOnClass(DispatcherServlet.class)
目的是为了,只有Web环境的微服务当前配置才会被激活
com.rabbitmq.client.AuthenticationFailureException
Caused by: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
解决:
检查RabbitMQ的用户名和密码和连接配置
java.sql.SQLNonTransientConnectionException
com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:mysql://localhost:3306/tlias?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai, errorCode 0, state 08001 java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
原因:
具体原因未知...,可能,SpringBoot运行过程中,mysql服务重新启动了,导致报错
解决:
cmd控制台,开启mysql服务,输入用户名和密码连接mysql,重启SprintBoot项目
- 启动mysql服务
net start mysql
- 登录mysql
mysql -u root -p
- 登出mysql
exit
com.mysql.cj.jdbc.exceptions.CommunicationsException
com.alibaba.druid.pool.DruidDataSource : create connection SQLException, url: jdbc:mysql://localhost:3306/tlias?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai, errorCode 0, state 08S01
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
原因:
SpringBoot运行过程中,mysql服务停止,导致报错
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
原因:
与 MySQL 服务器的通信出现了问题
org.apache.ibatis.exceptions.TooManyResultsException
Caused by: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
原因:
你调用了一个应该返回单个结果的方法(如selectOne()),但查询结果有多于一个的记录。这通常是因为你的查询条件匹配到了多条记录,而你的代码却期望只返回一条记录
com.mysql.cj.jdbc.exceptions.MysqlDataTruncation
Caused by: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'name' at row 1
原因:
向MySQL数据库的某个字段插入数据时,如果数据的实际长度超过了该字段定义的最大长度,MySQL就会抛出“Data too long for column”错误
java.sql.SQLIntegrityConstraintViolationException
Caused by: java.sql.SQLIntegrityConstraintViolationException: Column 'name' cannot be null
原因:
提示name字段不能为空,是因为数据库里加了非null约束
java.sql.SQLIntegrityConstraintViolationException
Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '411381200202193234' for key 'student.id_number'
原因:
插入数据时,具有唯一约束条件的列值重复了
java.sql.SQLException
Caused by: java.sql.SQLException: Column count doesn't match value count at row 1
原因:
列和值数量不一致
Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
原因:
数据库连接用户名或密码错误
Caused by: java.sql.SQLException: Before start of result set
原因:
ResultSet 中获取数据之前,未调用next()
方法
Caused by: java.sql.SQLException: Column 'id_number' not found.
原因:
获取的字段和列名没有匹配到
java.sql.SQLSyntaxErrorException
Caused by: java.sql.SQLSyntaxErrorException: Unknown database 'db'
原因:
找不到db数据库
Caused by: java.sql.SQLSyntaxErrorException: Table 'test84.user' doesn't exist
原因:
名为 test84 的数据库中不存在名为 user 的表。
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'clazz_id' in 'field list'
原因:
SQL 查询中使用clazz_id作为列,但在数据库中没有找到对应的clazz_id列名
标签:java,记录,sql,Caused,常见,SQLException,遇见,mysql,com From: https://www.cnblogs.com/yqiang/p/18488073