【Java】异常合集

【Java】异常合集,第1张

1.BindingException
org.apache.ibatis.binding.BindingException: 
Type interface com.jcli.dao.UserDao is not known to the MapperRegistry.

1.SqlMapConfig.xml里面路径未改。

2.SqlMapConfig.xml的mappers没有告诉mybatis映射文件位置。


        
        
    

3.映射文件名写错 


org.apache.ibatis.binding.BindingException: 
Invalid bound statement (not found): 
com.jcli.dao.UserDao.findAll
2.NullPointerException
java.lang.NullPointerException

1.多new了一个工厂对象,导致地址不一样

3.ReflectionException
org.apache.ibatis.exceptions.PersistenceException: 
Caused by: org.apache.ibatis.reflection.ReflectionException: 
Could not set property 'address02' of 'class com.jcli.bean.User' with value '北京' Cause:
 org.apache.ibatis.reflection.ReflectionException: 
There is no setter for property named 'address02' in 'class com.jcli.bean.User'

1.自己写了个不存在的属性

4.BeanCreationException
Caused by: 
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'userService' defined in file [D:\jclicode\springboot\springboot04-junit\target\classes\com\jcli\service\UserService.class]: 
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [com.jcli.service.UserService]: 
Specified class is an interface

1. 配置文件中没有写端口号,加上就运行了。

server:
  port: 8888
#spring data source数据源配置
spring:
  datasource:
#    driver-class-name: com.mysql.jdbc.Driver
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost/jcli_springboot?useUnicode=true&characterEncoding=UTF-8
    username: root
    password: admin

无解问题,重写又可以

5.InvalidConnectionAttributeException
com.mysql.cj.exceptions.InvalidConnectionAttributeException: 
The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_202]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_202]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_202]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_202]

 配置文件加:

default-time-zone = '+8:00'

 url接:ok

&serverTimezone=UTC

 

持续更新中~~~

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/730795.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存