shuaige7788
shuaige7788
2009-10-13 18:17
浏览 280
已采纳

ERROR LazyInitializationException:19 - illegal access to loading collection

挺郁闷的,今天做了并发测试(5个同时并发),TOMCAT控制台抱出了这些:

[color=red]
LazyInitializationException:19 - illegal access to loading collection
org.hibernate.LazyInitializationException: illegal access to loading collection[/color]

at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
at org.apache.struts2.util.MakeIterator.convert(MakeIterator.java:81)
at org.apache.struts2.components.IteratorComponent.start(IteratorComponent.java:210)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f1(blogIndexByPage_jsp.java:485)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f0(blogIndexByPage_jsp.java:396)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspService(blogIndexByPage_jsp.java:222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

...........
...........(省略)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

Hibernate: select blogcaterg0_.blogButtonId as blogButt4_1_, blogcaterg0_.id as id1_, blogcaterg0_.id as id4_0_, blogcaterg0_.catergoryName as catergor2_4_0_, blogcaterg0_.catergoryInfor as catergor3_4_0_, blogcaterg0_.blogButtonId as blogButt4_4_0_ from blogcatergory blogcaterg0_ where blogcaterg0_.blogButtonId=? order by blogcaterg0_.id

[color=red]2009-10-13 15:09:39 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
org.hibernate.LazyInitializationException: illegal access to loading collection
at org.hibernate.collection.AbstractPersistentCollection.initialize/color
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
at org.apache.struts2.util.MakeIterator.convert(MakeIterator.java:81)
at org.apache.struts2.components.IteratorComponent.start(IteratorComponent.java:210)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f1(blogIndexByPage_jsp.java:485)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f0(blogIndexByPage_jsp.java:396)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspService(blogIndexByPage_jsp.java:222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

[size=medium][color=blue]单独跑的时候没问题,可以一起5个对同一操作并发的时候,就抛这些异常。是我事务配置的问题吗?还是什么原因?[/size]谢谢。[/color]
[b]问题补充:[/b]
[size=large]挺郁闷的,今天做了并发测试(5个同时并发),TOMCAT控制台抱出了这些:[/size]

[color=red]
LazyInitializationException:19 - illegal access to loading collection
org.hibernate.LazyInitializationException: illegal access to loading collection[/color]

at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
at org.apache.struts2.util.MakeIterator.convert(MakeIterator.java:81)
at org.apache.struts2.components.IteratorComponent.start(IteratorComponent.java:210)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f1(blogIndexByPage_jsp.java:485)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f0(blogIndexByPage_jsp.java:396)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspService(blogIndexByPage_jsp.java:222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

...........
...........(省略)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

Hibernate: select blogcaterg0_.blogButtonId as blogButt4_1_, blogcaterg0_.id as id1_, blogcaterg0_.id as id4_0_, blogcaterg0_.catergoryName as catergor2_4_0_, blogcaterg0_.catergoryInfor as catergor3_4_0_, blogcaterg0_.blogButtonId as blogButt4_4_0_ from blogcatergory blogcaterg0_ where blogcaterg0_.blogButtonId=? order by blogcaterg0_.id

[color=red]2009-10-13 15:09:39 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
org.hibernate.LazyInitializationException: illegal access to loading collection
at org.hibernate.collection.AbstractPersistentCollection.initialize/color
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
at org.apache.struts2.util.MakeIterator.convert(MakeIterator.java:81)
at org.apache.struts2.components.IteratorComponent.start(IteratorComponent.java:210)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f1(blogIndexByPage_jsp.java:485)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspx_meth_s_005fiterator_005f0(blogIndexByPage_jsp.java:396)
at org.apache.jsp.jsp.blog.blogIndexByPage_jsp._jspService(blogIndexByPage_jsp.java:222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

[size=medium][color=blue]单独跑的时候没问题,可以一起5个对同一操作并发的时候,就抛这些异常。是我事务配置的问题吗?还是什么原因?[/size]谢谢。[/color]

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • wanghaolovezlq
    wanghaolovezlq 2009-10-13 18:19
    已采纳
    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-10-13 18:19

    org.hibernate.LazyInitializationException: illegal access to loading collection

    延迟加载的问题嘛

    用opensessioninview去解决

    点赞 评论

相关推荐