栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

hibernate引发NullPointerException

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

hibernate引发NullPointerException

该消息向我表明它无法连接到数据库。仔细检查您的连接字符串,并确保您的驱动程序在类路径中。我还认为您需要将“
jdbc”作为连接字符串的一部分,除非最近进行了更改。

<property name="hibernate.connection.url" value="jdbc:postgres://****:****@ec2-***-**-***-***.compute-1.amazonaws.com:6232/*****"/>

编辑:我只是盯着这个库的先前版本的来源,如果第214行与这两个版本相同,则您的连接肯定为空(即未发生)。

这是

DriverManagerConnectionProviderImpl
我方便使用的版本的214行:(4.2.0.CR2)

214     if ( conn.getAutoCommit() != autocommit ) {215         conn.setAutoCommit(autocommit);216     }

以下是前几行:

198     Connection conn;199     if ( driver != null ) {200         // If a Driver is available, completely circumvent201         // DriverManager#getConnection.  It attempts to double check202         // ClassLoaders before using a Driver.  This does not work well in203         // OSGi environments without wonky workarounds.204         conn = driver.connect( url, connectionProps );205     }206     else {207         // If no Driver, fall back on the original method.208         conn = DriverManager.getConnection( url, connectionProps );209     }210     211     if ( isolation != null ) {212         conn.setTransactionIsolation( isolation.intValue() );213     }214     if ( conn.getAutoCommit() != autocommit ) {215         conn.setAutoCommit(autocommit);216     }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/412853.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号