[3.7.0 Railo] org.hibernate.LazyInitializationException

125 views
Skip to first unread message

XERRANO

unread,
Dec 6, 2013, 11:39:01 AM12/6/13
to col...@googlegroups.com
Hi guys, yesterday had this error in my home page of a site, using "fwreinit" it go away... but today the same error within an "admin section using solitary module" appear again,
I use fwreinit but the error did not go away... maybe because of solitary?

Any way, does any one have come across this type of error on Railo?

Thanks!


Railo 4.1.2.004 Error (org.hibernate.LazyInitializationException)
Message failed to lazily initialize a collection of role: User.roles, no session or session was closed
Cause org.hibernate.LazyInitializationException
Stacktrace The Error Occurred in
/opt/railo/lib/railo-server/context/library/tag/Dump.cfc: line 94
92: }
93: catch(e) {
94: var meta = dumpStruct(structKeyExists(attrib,'var') ? attrib.var : nullValue(), attrib.top, attrib.show, attrib.hide, attrib.keys, attrib.metaInfo, attrib.showUDFs);
95: }
96:

called from /home/rebate/public_html/coldbox/system/includes/BugReport.cfm: line 223
221: <tr>
222: <td align="right" class="fw_errorTablesTitles"> #key#: </td>
223: <td><cfif isSimpleValue( sessioncbstorage[ key ] )>#htmlEditFormat( sessioncbstorage[ key ] )#<cfelse>#key# <cfdump var="#sessioncbstorage[ key ]#"></cfif></td>
224: </tr>
225: </cfloop>

called from /home/rebate/public_html/coldbox/system/web/services/ExceptionService.cfc: line 114
112: <cfelse>
113: <!--- Save the Bug Report --->
114: <cfsavecontent variable="cboxBugReport"><cfinclude template="/coldbox/system/includes/BugReport.cfm"></cfsavecontent>
115: </cfif>
116: <cfreturn cboxBugReport>

called from /home/rebate/public_html/coldbox/system/Coldbox.cfc: line 353
351:
352: <!--- Render The Exception --->
353: <cfoutput>#exceptionService.renderBugReport(ExceptionBean)#</cfoutput>
354: </cfcatch>
355: </cftry>

called from /home/rebate/public_html/Application.cfc: line 121
119: <cfif findNoCase('index.cfm', listLast(arguments.targetPage, '/'))>
120: <!--- Reload Checks --->
121: <cfset application.cbBootStrap.processColdBoxRequest()>
122: </cfif>
123:

Java Stacktrace failed to lazily initialize a collection of role: User.roles, no session or session was closed
  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383):383
  at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375):375
  at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:368):368
  at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:111):111
  at org.hibernate.collection.PersistentBag.listIterator(PersistentBag.java:469):469
  at railo.runtime.dump.DumpUtil.toDumpData(DumpUtil.java:244):244
  at railo.runtime.type.util.StructUtil.toDumpTable(StructUtil.java:124):124
  at railo.runtime.type.util.StructSupport.toDumpData(StructSupport.java:131):131
  at railo.runtime.dump.DumpUtil.toDumpData(DumpUtil.java:224):224
  at railo.runtime.functions.other.DumpStruct.call(DumpStruct.java:65):65
  at railo.runtime.functions.other.DumpStruct.call(DumpStruct.java:54):54
  at dump_cfc$cf.udfCall1(/opt/railo/lib/railo-server/context/library/tag/Dump.cfc:94):94
  at dump_cfc$cf.udfCall(/opt/railo/lib/railo-server/context/library/tag/Dump.cfc):-1
  at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
  at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
  at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:199):199
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:624):624
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
  at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1749):1749
  at railo.runtime.tag.CFTag.cfcStartTag(CFTag.java:371):371
  at railo.runtime.tag.CFTag.doStartTag(CFTag.java:158):158
  at system.includes.bugreport_cfm$cf.call(/home/rebate/public_html/coldbox/system/includes/BugReport.cfm:223):223
  at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:837):837
  at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:784):784
  at system.web.services.exceptionservice_cfc$cf.udfCall(/home/rebate/public_html/coldbox/system/web/services/ExceptionService.cfc:114):114
  at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
  at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
  at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
  at railo.runtime.ComponentImpl.call(ComponentImpl.java:1732):1732
  at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:713):713
  at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
  at coldbox.system.coldbox_cfc$cf.udfCall1(/home/rebate/public_html/coldbox/system/Coldbox.cfc:353):353
  at coldbox.system.coldbox_cfc$cf.udfCall(/home/rebate/public_html/coldbox/system/Coldbox.cfc):-1
  at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
  at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
  at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
  at railo.runtime.ComponentImpl.call(ComponentImpl.java:1732):1732
  at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:713):713
  at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
  at application_cfc$cf.udfCall(/home/rebate/public_html/Application.cfc:121):121
  at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
  at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
  at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
  at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
  at railo.runtime.ComponentImpl.call(ComponentImpl.java:1732):1732
  at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:387):387
  at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:113):113
  at railo.runtime.listener.ModernAppListener.onRequest(ModernAppListener.java:83):83
  at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2170):2170
  at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2137):2137
  at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:332):332
  at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722):722
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304):304
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224):224
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169):169
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472):472
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168):168
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100):100
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405):405
  at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200):200
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515):515
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302):302
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source):-1
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1
  at java.lang.Thread.run(Unknown Source):-1
 
Timestamp 12/6/13 10:25:53 AM CST

Luis Majano

unread,
Dec 6, 2013, 11:53:05 AM12/6/13
to coldbox
Are you storing the object in session or some volatile scope?

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

XERRANO

unread,
Dec 6, 2013, 12:05:48 PM12/6/13
to col...@googlegroups.com
Hi Luis,

The Admin credentials are being stored in "session" that is correct. This error is practically new to me, I did a Railo upgrade to 4.1.2.004, but I did that about a week ago, could this be related?


Thanks

Curt Gratz

unread,
Dec 6, 2013, 12:13:13 PM12/6/13
to col...@googlegroups.com
You can't store ORM objects in session, they will become "detached".   Just store the ID and get the object on the request.  

Curt

--

Luis Majano

unread,
Dec 6, 2013, 12:16:26 PM12/6/13
to col...@googlegroups.com
Like Curt said.  When you store an ORM object in a volatile scope, you can, but there are intricacies.

One, if you have lazy or proxied relationships, they must all be loaded in order to work correctly.
Two, you can re-attach the object back into the session using entity merge or the merge() method in the orm services
Three, you can store simple id’s in the volatile scopes and then just request the object from ORM on a per request basis (I would combine that with ORM secondary cache)


Luis F. Majano
CEO
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
IECFUG Manager: http://www.iecfug.com
signature0.jpg

XERRANO

unread,
Dec 6, 2013, 12:29:00 PM12/6/13
to col...@googlegroups.com
Ok, in that case I got that wrong... Im not storing ORM Objects into nothing, what I'm storing in session as you mention are the "Admin Credentials: id,roles,etc" but the ORM object I left them alone. 
All the securty ORM  objects are handle by solitary itself....

Thanks

XERRANO

unread,
Dec 8, 2013, 2:19:50 PM12/8/13
to col...@googlegroups.com
Digging to find why I was getting this strange (for me) error:

Error (org.hibernate.LazyInitializationException)
Message failed to lazily initialize a collection of role: User.roles, no session or session was closed
Cause org.hibernate.LazyInitializationException

When all was working "fine" and then that start to showing up.
I finally found my bug, but that brought to me another question, why a Hibernate error when by mistake I use this:

<cfset var plugininstance = getPlugin(plugin="myplugin",customPlugin=false) />
Instead of this:
<cfset var plugininstance = getPlugin(plugin="myplugin",customPlugin=true) />

By calling a custom plugin and using customPlugin as false, that was mi issue, I don't find a relation since I do not use Hibernate in my own handlers.


Thanks



br...@bradwood.com

unread,
Dec 8, 2013, 5:11:20 PM12/8/13
to col...@googlegroups.com
I can't imagine how getting the wrong version of a plugin would have caused the error you were receiving.  Are you saying you don't use ORM at all?  What was the plugin in question?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
--

XERRANO

unread,
Dec 9, 2013, 12:28:24 AM12/9/13
to col...@googlegroups.com
Hi Brad, a simple CFC  with no database functions, but this CFC is inside a protected session using solitary module which as you might know it is ORM driven. I do not know using customPlugin as false when it should be true could trigger inside this "protected" session.


Thanks


br...@bradwood.com

unread,
Dec 9, 2013, 5:38:21 AM12/9/13
to col...@googlegroups.com
You must have two plugins with the same name-- one in the coldbox.system.plugins folder, and one in your custom plugin location.  When customPlugin is false, it will use the default system one.  When customPlugin is true, it will use your custom one instead.  

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
Subject: Re: [coldbox:20305] Re: [3.7.0 Railo] org.hibernate.LazyInitializationException
From: "XERRANO" <red...@xerrano.com>
--

XERRANO

unread,
Dec 10, 2013, 9:05:08 PM12/10/13
to col...@googlegroups.com
Thank you guys :) for your time and support!
Reply all
Reply to author
Forward
0 new messages