zoukankan      html  css  js  c++  java
  • mysql连接报java.math.BigInteger cannot be cast to java.lang.Long异常

    使用hibernate出现以下错误

    java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
        at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1074)
        at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3590)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2531)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2301)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:215)
        at zttc.itat.user.util.DbUtil.getConnection(DbUtil.java:12)
        at zttc.itat.user.util.AbstractDbUnitTestCase.init(AbstractDbUnitTestCase.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

     后来将 mysql-connector-java-5.1.24.jar 换成了mysql-connector-java-5.1.46.jar 就解决了。

    ----- ----- ----- ----- 谢谢大佬打赏----- ----- ----- ----- ----- 

     (转自:https://bbs.csdn.net/topics/392272603)(@KLOVEYY

  • 相关阅读:
    在 Ubuntu 14.04 Chrome中安装Flash Player(转)
    Tomcat 域名绑定多个Host配置要点
    IIS7.5 与 Tomcat 8整合
    笔记本外接显示器闪屏
    NetworkManager 命令配置nmcli注意
    CentOS 7 目录布局变化
    CentOS 7 Crontab
    jquery的ajax post 方法传值到后台,无法通过HttpServletRequest得到
    没有添加spring mvc 默认依赖包产生的错误
    tcp总结
  • 原文地址:https://www.cnblogs.com/Jomini/p/9497360.html
Copyright © 2011-2022 走看看