zoukankan      html  css  js  c++  java
  • Mybatis 报错

    Mybatis 报错

    builder.BuilderException: Error parsing SQL Mapper Configuration

    Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/xxx/dao/UserDao.xml
    

    image-20200704162223175

    这个原因是我的 resources 文件下面的 package 不能建立,因此我将其标记为 test resources,问题解决

    image-20200704222258355

    It's likely that neither a Result Type nor a Result Map was specified

    这个原因是:Mybatis配置文件中没有返回类型参数

    Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException 是文件查询之后不知道将结果集封装到哪里

    image-20200704162325182

    因此在查询的方法id后面添加一个resultType,

    image-20200704212854636

    将结果封装至User

    image-20200704213215783

    InvalidConnectionAttributeException

    还有一个关于时区的问题,此问题为时区问题,在 JDBC 的连接 url 部分加上 serverTimezone=UTC 即可。
    如果选择utc会比中国时间早8个小时,如果在中国,可以选择Asia/Shanghai或者Asia/Hongkong

    UTC 即 Universal Time Coordinated 世界标准时间

    Caused by: 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.
    

    解决方法:

    <property name="url" value="jdbc:mysql://localhost:3306/dbMybatis?serverTimezone=UTC"/>
    
  • 相关阅读:
    Lucene:(一)建立索引文件:2。建立索引文件(一)
    Lucene:(一)建立索引文件:2。建立索引文件(二)Segment文件
    92.外边距设置 Walker
    99.元素居中及样式重置 Walker
    94.外边距踩坑 Walker
    101.列表属性 Walker
    97.boxsizing属性 Walker
    98.溢出隐藏 Walker
    95.内边距设置 Walker
    96.内边距和边框踩坑 Walker
  • 原文地址:https://www.cnblogs.com/like3ong/p/13237010.html
Copyright © 2011-2022 走看看