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>

没有配置对。修改便是。

最新文章

  1. Android - ADB 的使用
  2. Paris Traceroute
  3. C#程序中:如何向xml文件中插入节点(数据)
  4. RuntimePermissions
  5. java排序算法-插入排序
  6. IO流+数据库课后习题
  7. 页面按F5重复提交数据解决方法
  8. svg snap 笔记
  9. 07_SSH免登录配置
  10. 蓝桥杯 求最大值 dp
  11. C#把动态创建的多个控件中指定控件显示在最上层
  12. Request Body可以反复读取的方法
  13. java之接口文档规范
  14. 转:甲骨文发布大数据解决方案 含最新版NoSQL数据库
  15. printf 输出% 和 \
  16. C 语法中static 和inline联合使用
  17. [arc082E]ConvexScore-[凸包]
  18. 为什么我们选择parquet
  19. hdu 4628 Pieces 状态压缩dp
  20. 如何监控Oracle

热门文章

  1. 【转载】Java中使用Jedis操作Redis
  2. bootstrap模板
  3. javascript语言基础知识
  4. 剑指offer 面试18题
  5. MAXIMUM SUBSEQUENCE SUM PROBLEM
  6. PHP基本语法,类基本函数
  7. 深入浅出Node.js(下)
  8. qq 微信 微博 第三方分享
  9. gzframework开发记录
  10. Docker容器技术-基础命令