来自 LocalSessionFactoryBuilder 的 NullPointerException
我同时使用Spring和hibernate(hibernate 4.0.1和spring 3.1)。我在 applicatonContext.xml 中使用以下 bean 定义,
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>
在实例化 bean 时出现以下错误。
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.<init>(LocalSessionFactoryBuilder.java:101)
从谷歌搜索看来缺陷是在 Spring 中。有什么解决办法吗? 降级我的 Hibernate 和/或 Spring 有帮助吗?
I am using Spring and hibernate together (hibernate 4.0.1 and spring 3.1). I am using the following bean definition in applicatonContext.xml
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>
I am getting the following error while instantiating the bean.
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.<init>(LocalSessionFactoryBuilder.java:101)
From google search it looks like the defect is in Spring. Is there any solution for this?
Will downgrading my Hibernate and/or Spring help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个 Spring 错误 (SPR-8924)。 3.1.1 已修复此问题,但尚未发布。
如果您绝望,您可以获取最近的夜间快照< /a> 应该有修复,但当然夜间快照不一定稳定。
或者,坚持使用 Hibernate 3,Spring 也支持它。
It is a Spring bug (SPR-8924). It's been fixed for 3.1.1, which isn't out yet.
If you're desperate, you could get the most recent nightly snapshot which should have the fix in, but of course the nightly snapshots aren't necessarily stable.
Alternatively, stick with Hibernate 3, which Spring also supports.