org.hibernate.LazyInitializationException: could not initialize proxy [com.example.shop.dataobject.User#16] - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:170) ~[hibernate-core-5.4.8.Final.jar:5.4.8.Final]
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:310) ~[hibernate-core-5.4.8.Final.jar:5.4.8.Final]
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor.intercept(ByteBuddyInterceptor.java:45) ~[hibernate-core-5.4.8.Final.jar:5.4.8.Final]
at org.hibernate.proxy.ProxyConfiguration$InterceptorDispatcher.intercept(ProxyConfiguration.java:95) ~[hibernate-core-5.4.8.Final.jar:5.4.8.Final]
at com.example.shop.dataobject.User$HibernateProxy$VAtYZAqu.toString(Unknown Source) ~[classes/:na]
at com.example.shop.shiro.UserRealm.doGetAuthorizationInfo(UserRealm.java:39) ~[classes/:na]
at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationInfo(AuthorizingRealm.java:341) ~[shiro-core-1.4.0.jar:1.4.0]
at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:462) ~[shiro-core-1.4.0.jar:1.4.0]
at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:458) ~[shiro-core-1.4.0.jar:1.4.0]
at org.apache.shiro.authz.ModularRealmAuthorizer.isPermitted(ModularRealmAuthorizer.java:223) ~[shiro-core-1.4.0.jar:1.4.0]
at org.apache.shiro.mgt.AuthorizingSecurityManager.isPermitted(AuthorizingSecurityManager.java:113) ~[shiro-core-1.4.0.jar:1.4.0]
at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:162) ~[shiro-core-1.4.0.jar:1.4.0]

根据日志信息,他指向了 User 实体类,

是因为懒加载导致的

解决办法:

在User实体类上加上

@Proxy(lazy=false)
完整代码

springboot 出现 org.hibernate.LazyInitializationException: could not initialize proxy的更多相关文章

  1. 【bug记录】jpa 解决org.hibernate.lazyinitializationexception could not initialize proxy - no session

    前言 最近开发项目比较忙,Spring Cloud的笔记得稍稍放放了,下午出来个bug,恶心的不行,功能很简单,也没有什么级联或复杂的映射关系,就是一直在报三个异常 Caused by: com.fa ...

  2. 解决org.hibernate.LazyInitializationException: could not initialize proxy - no Session懒载入问题

    问题描写叙述: Struts Problem Report Struts has detected an unhandled exception: Messages: could not initia ...

  3. J2EE进阶(九)org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    org.hibernate.LazyInitializationException: could not initialize proxy - no Session 前言 在<many-to-o ...

  4. jpa 解决org.hibernate.lazyinitializationexception could not initialize proxy - no session

    org.hibernate.LazyInitializationException: could not initialize proxy [org.alan.entity.SysUser#1] - ...

  5. Exception 07 : org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    异常名称: org.hibernate.LazyInitializationException: could not initialize proxy - no Session 异常截图: 异常详情: ...

  6. 解决方案,org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    org.hibernate.LazyInitializationException: could not initialize proxy - no Session org.hibernate.pro ...

  7. Hibernate和Spring整合出现懒加载异常:org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    出现问题:  SSH整合项目里,项目目录结构如下: 在EmployeeAction.java的list()方法里将employees的list放入到request的Map中. EmployeeActi ...

  8. dubbo序列化hibernate.LazyInitializationException could not initialize proxy - no Session懒加载异常的解决

    dubbo序列化,hibernate.LazyInitializationException could not initialize proxy - no Session懒加载异常的解决 转载声明: ...

  9. 总结懒加载的解决方法(全)org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    如下错误:org.hibernate.LazyInitializationException: could not initialize proxy - no Session 原因是懒加载的问题,因为 ...

随机推荐

  1. node 和 postgres

    安装 npm i pg ,如果慢的话,记得爬梯子 连接池的方式: var pg = require('pg'); // 数据库配置 var config = { user:"postgres ...

  2. java封装数据类型——Integer

    今天来学习整型 int 的封装数据类型,Integer. 1. 定义 首先来看看定义.可以看到,Integer 继承 Number 抽象类,实现了 Comparable 接口.Number 类是常用数 ...

  3. web中间件

    0x00 Web中间件概述 通俗来说,中间件是提供系统软件和应用软件之间连接的软件,以便于软件各部件之间的沟通.Apache的Tomcat.IBM公司的WebSphere.BEA公司的WebLogic ...

  4. Linq以本周和本月为条件的Sql,Liqn查询本周,Linq查询本月

    //计算本周时间 时间 > DateTime.Now.AddDays(-Convert.ToInt32(DateTime.Now.Date.DayOfWeek) //计算本月时间 时间 > ...

  5. springboot 部署到tomcat中,项目总是重新部署

    tomcat目录中-conf文件夹下 <Host name="www.xxx.com" appBase="webapps" unpackWARs=&quo ...

  6. 从c到c++<二>

    用于对与局部变量同名的全局变量进行访问下面通过程序来进行说明:运行看一下: 用于表示类的成员,这将在关于类的一节中详细说明 对于学过java的人来说,应该对于new运算符很容易理解,它实际上相当于c语 ...

  7. nginx 缓存区太小导致后台Connection reset by peer 报错

    问题概述:图片bit 64生成数据流太大,导致小程序分享弹窗的二维码图片生成失败 后台报错: 排查: Client------>nginx------->h5------>nginx ...

  8. DataWorks入门

    阿里云有很多成熟的云产品(萌新认知),我自己只用过腾讯云的对象存储,对这类云产品不是特别了解. 有幸参与到大数据相关的项目,跟着学了点工具的使用方法,非常简单,也了解了一些使用大数据分析问题的流程. ...

  9. SpringMVC 一次请求加载Controller多次

    原因之一:HTML页面中 css样式 background:url() 或 img.iframe标签 src设置为空 例:<div style="background:url()&qu ...

  10. 获取mysql一组数据中的第N大的值

    create table tb(name varchar(10),val int,memo varchar(20)) insert into tb values('a', 2, 'a2') inser ...