hibernate报错org.hibernate.HibernateException: No CurrentSessionContext configured!
org.hibernate.HibernateException: No CurrentSessionContext configured!
	at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:695)
	at cn.itcast.utils.HibernateUtils.getSessionObject(HibernateUtils.java:20)
	at cn.itcast.hibernatetest.HibernateSelect.testTx01(HibernateSelect.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
可能是使用getCurrentSession()出现了问题,问题原因可能是hibernate.cfg.xml文件中的
<!-- 在hibernate核心配置文件中配置 -->
<property name="hibernate.current_session_context_class">thread</property>
没有配置对。修改便是。
hibernate报错org.hibernate.HibernateException: No CurrentSessionContext configured!的更多相关文章
- Hibernate 报错org.hibernate.PropertyAccessException: IllegalArgumentException(已解决)
		
无聊想搭建一个项目,练手,做点小功能就一个卡在这个问题上 org.hibernate.PropertyAccessException: IllegalArgumentException occurre ...
 - hibernate报错org.hibernate.SessionException: Session was already closed
		
org.hibernate.SessionException: Session was already closedat org.hibernate.internal.SessionImpl.clos ...
 - Hibernate(三): org.hibernate.HibernateException: No CurrentSessionContext configured!
		
Hibernate版本5.2.9 获取Session的方式是sessionFactory.getCurrentSession(); 比较老一些的版本使用的是sessionFactory.openSes ...
 - Hibernate报错,关于配置的SessionFactory找不到问题
		
最近写项目使用hibernate默认的dtd,在启动项目时经常会出现这个问题,hibernate报错,配置factory的id找不到,找不到mapping配置文件, 不能读取配置的xml文件 Coul ...
 - eclipse egit 报错 The current branch is not configured for pull No value for key branch.master
		
eclipse egit 插件 pull报错 The current branch is not configured for pull No value for key branch.master ...
 - spring+hibernate整合:报错org.hibernate.HibernateException: No Session found for current thread
		
spring+hibernate整合:报错信息如下 org.hibernate.HibernateException: No Session found for current thread at o ...
 - Hibernate中报错org.hibernate.HibernateException: No CurrentSessionContext configured!
		
报错信息如下: 解决方法: 问题原因是getCurrentSession()出现了问题 在hibernate.cfg.xml(hibernate的核心配置文件)文件中加入下列代码: <prope ...
 - Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法
		
报错信息: org.hibernate.event.internal.DefaultLoadEventListener onLoad INFO: HHH000327: Error performing ...
 - hibernate报错Unknown integral data type for ids : java.lang.String
		
package com.model; // Generated 2016-10-27 14:02:17 by Hibernate Tools 4.3.1.Final /** * CmDept gene ...
 
随机推荐
- JAVA的Hashtable在遍历时的迭代器线程问题
			
这篇博客主要讲什么 Hashtable及其内部类的部分源码分析 Hashtable在遍历时的java.util.ConcurrentModificationException异常的来由和解决 单机在内 ...
 - Oracle 逻辑体系
			
Oracle 逻辑体系 主题 Oracle 逻辑体系 参考资料 Oracle 逻辑体系 表空间.模式.用户.段.区.块 Oracle中的数据逻辑上存储于表空间,物理上则存储于属于表空间tabl ...
 - Toeplitz matrix
			
w https://en.wikipedia.org/wiki/Toeplitz_matrix Proof of Stolz-Cesaro theorem | planetmath.org http ...
 - docker openvas
			
https://hub.docker.com/r/mikesplain/openvas/ Requirements DockerPorts available: 443, 9390, 9391 Usa ...
 - dbUtils 原理
			
// Jdbc 的增,删, 改流程类似,只是参数不同, 因此可以向上抽取 public class Demo{ // Jdbc 的增加 public void addStu(Stu stu){ Con ...
 - Nuxt使用Vuex
			
Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生变化. 基础知识这里不再重述,学习的话请自行到官网 ...
 - PAT 1072. 开学寄语(20) JAVA
			
下图是上海某校的新学期开学寄语:天将降大任于斯人也,必先删其微博,卸其QQ,封其电脑,夺其手机,收其ipad,断其wifi,使其百无聊赖,然后,净面.理发.整衣,然后思过.读书.锻炼.明智.开悟.精进 ...
 - CentOS中yum安装Java
			
查看CentOS自带JDK是否已安装.◆输入:yum list installed |grep java. 若有自带安装的JDK,如何卸载CentOS系统自带Java环境?◆卸载JDK相关文件输入:y ...
 - 蓝图、基于DBUtils实现数据库连接池、上下文管理等
			
基于DBUtils实现数据库连接池 小知识: 1.子类继承父类的三种方式 class Dog(Animal): #子类 派生类 def __init__(self,name,breed, life_v ...
 - Web安全相关资料
			
Asp.net安全架构: http://www.cnblogs.com/luminji/category/381486.html