无法初始化代理 - 再次没有会话

发布于 2024-08-25 19:08:43 字数 1844 浏览 8 评论 0原文

查看页面时收到这些错误日志,

ERROR [TP-Processor11] (LazyInitializationException.java:42) - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)
    at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
    at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
    at org.osmoz.contents.model.enm.ContentType_$$_javassist_71.getDefaultShortMode(ContentType_$$_javassist_71.java)
    at org.osmoz.contents.web.tapestry.components.EnmContentZone.getTemplate(EnmContentZone.java:67)
    at org.osmoz.contents.web.tapestry.base.AbstractRawContentZone.getContent(AbstractRawContentZone.java:67)
    at $PropertyConduit_1276091af82.get($PropertyConduit_1276091af82.java)
    at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)
    at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:510)
    at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:496)
    at org.apache.tapestry5.corelib.components.OutputRaw._$read_parameter_value(OutputRaw.java)
    at org.apache.tapestry5.corelib.components.OutputRaw.beginRender(OutputRaw.java:43)
    at org.apache.tapestry5.corelib.components.OutputRaw.beginRender(OutputRaw.java)
    at

我知道问题是会话已关闭。但我真的不知道为什么这个错误发生得不那么频繁,为什么我不知道根本原因是什么。

环境:

Tapestry5、JPA、Hibernate 3.3.2.GA

我已

<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>

在 web.xml 中 设置 还

I get these error log when viewing a page

ERROR [TP-Processor11] (LazyInitializationException.java:42) - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)
    at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
    at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
    at org.osmoz.contents.model.enm.ContentType_$_javassist_71.getDefaultShortMode(ContentType_$_javassist_71.java)
    at org.osmoz.contents.web.tapestry.components.EnmContentZone.getTemplate(EnmContentZone.java:67)
    at org.osmoz.contents.web.tapestry.base.AbstractRawContentZone.getContent(AbstractRawContentZone.java:67)
    at $PropertyConduit_1276091af82.get($PropertyConduit_1276091af82.java)
    at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)
    at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:510)
    at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:496)
    at org.apache.tapestry5.corelib.components.OutputRaw._$read_parameter_value(OutputRaw.java)
    at org.apache.tapestry5.corelib.components.OutputRaw.beginRender(OutputRaw.java:43)
    at org.apache.tapestry5.corelib.components.OutputRaw.beginRender(OutputRaw.java)
    at

I know the problem is Session has been closed. But I really don't know why this error occur not so often that why I don't know the root cause is.

Enviroment:

Tapestry5, JPA, Hibernate 3.3.2.GA

I've set

<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>

in web.xml
also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二智少女 2024-09-01 19:08:43

在使用 @Service(Spring 服务)注释的层中的方法上使用 @Transactional

Use @Transactional on a method in layer annotated with @Service(Spring service).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文