[ColdBox 3.6.0] Session LazyInitializationException

I got this error if I try to dump a session:

Application Execution ExceptionError Type: org.hibernate.LazyInitializationException : 0

Error Messages: could not initialize proxy - no Session

What causes this error?

This is the full stack:

Oops! Exception Encountered### Application Execution ExceptionError Type: org.hibernate.LazyInitializationException : 0

Error Messages: could not initialize proxy - no Session

Tag Context:
ID: ??
LINE: 88
Template: E:\railo\lib\railo-server\context\library\tag\Dump.cfc
ID: ??
LINE: 1
Template: E:\wamp\www\TropicalSeo\views\panel\index.cfm
ID: ??
LINE: 338
Template: E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc
ID: ??
LINE: 183
Template: E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc
ID: ??
LINE: 81
Template: E:\wamp\www\TropicalSeo\layouts\Layout.Main.cfm
ID: ??
LINE: 338
Template: E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc
ID: ??
LINE: 475
Template: E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc
ID: ??
LINE: 429
Template: E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc
ID: ??
LINE: 256
Template: E:\wamp\www\TropicalSeo\coldbox\system\Coldbox.cfc
ID: ??
LINE: 65
Template: E:\wamp\www\TropicalSeo\Application.cfc
Framework Snapshot
Current Event: panel.index
Current Layout: Layout.Main.cfm (Module: )
Current View: panel/index
Bug Date: 09/02/2013 07:40:22 PM
Coldfusion ID: JSessionID=11C6B87584033492C0F2BA29051F5FA7
Template Path : E:\wamp\www\TropicalSeo\index.cfm
Path Info : /panel
Host & Server: www.tropical.seo:8888 Francesco-PC
Query String:
Browser: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36
Remote Address: 127.0.0.1
Form variables:
Session Storage:
redirect: …/panel
user: user [complex]
Cookies:
username: “admin”
coldbox_debugmode_49937d654fe83ca6c41976244c0e1ce6: true
cftoken: 0
jsessionid: 11C6B87584033492C0F2BA29051F5FA7
defaultlocale: en_US
cfid: d26bc5a3-2826-4321-81e0-42321b96c4f0
Stack Trace:

could not initialize proxy - no Session
	at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167):167
	at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215):215
	at railo.runtime.orm.hibernate.tuplizer.proxy.CFCLazyInitializer.getCFC(CFCLazyInitializer.java:28):28
	at railo.runtime.CFCProxy.getComponentAccess(CFCProxy.java:25):25
	at railo.runtime.type.cfc.ComponentAccessProxy.getComponent(ComponentAccessProxy.java:22):22
	at railo.runtime.type.cfc.ComponentProxy.toDumpData(ComponentProxy.java:233):233
	at railo.runtime.dump.DumpUtil.toDumpData(DumpUtil.java:199):199
	at railo.runtime.type.util.StructUtil.toDumpTable(StructUtil.java:118):118
	at railo.runtime.type.util.StructSupport.toDumpData(StructSupport.java:124):124
	at railo.runtime.dump.DumpUtil.toDumpData(DumpUtil.java:199):199
	at railo.runtime.type.util.StructUtil.toDumpTable(StructUtil.java:118):118
	at railo.runtime.type.util.StructSupport.toDumpData(StructSupport.java:124):124
	at railo.runtime.dump.DumpUtil.toDumpData(DumpUtil.java:199):199
	at railo.runtime.type.util.StructUtil.toDumpTable(StructUtil.java:118):118
	at railo.runtime.type.scope.ScopeSupport.toDumpData(ScopeSupport.java:85):85
	at railo.runtime.type.scope.ScopeSupport.toDumpData(ScopeSupport.java:79):79
	at railo.runtime.dump.DumpUtil.toDumpData(DumpUtil.java:199):199
	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.udfCall(E:\railo\lib\railo-server\context\library\tag\Dump.cfc:88):88
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275
	at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608
	at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
	at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800
	at railo.runtime.tag.CFTag.cfcStartTag(CFTag.java:361):361
	at railo.runtime.tag.CFTag.doStartTag(CFTag.java:160):160
	at views.panel.index_cfm$cf.call(E:\wamp\www\TropicalSeo\views\panel\index.cfm:1):1
	at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:802):802
	at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:749):749
	at coldbox.system.plugins.renderer_cfc$cf._1(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc:338):338
	at coldbox.system.plugins.renderer_cfc$cf.udfCall(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc):-1
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
	at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
	at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
	at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
	at coldbox.system.plugins.renderer_cfc$cf._1(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc:183):183
	at coldbox.system.plugins.renderer_cfc$cf.udfCall(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc):-1
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
	at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
	at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
	at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
	at layouts.layout_main_cfm322$cf.call(E:\wamp\www\TropicalSeo\layouts\Layout.Main.cfm:81):81
	at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:802):802
	at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:749):749
	at coldbox.system.plugins.renderer_cfc$cf._1(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc:338):338
	at coldbox.system.plugins.renderer_cfc$cf.udfCall(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc):-1
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
	at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
	at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
	at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
	at coldbox.system.plugins.renderer_cfc$cf._call000028(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc:475):475
	at coldbox.system.plugins.renderer_cfc$cf._1(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc:429):429
	at coldbox.system.plugins.renderer_cfc$cf.udfCall(E:\wamp\www\TropicalSeo\coldbox\system\plugins\Renderer.cfc):-1
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275
	at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608
	at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
	at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800
	at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749
	at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1521):1521
	at coldbox.system.coldbox_cfc$cf._1(E:\wamp\www\TropicalSeo\coldbox\system\Coldbox.cfc:256):256
	at coldbox.system.coldbox_cfc$cf.udfCall(E:\wamp\www\TropicalSeo\coldbox\system\Coldbox.cfc):-1
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
	at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
	at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
	at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
	at application_cfc$cf.udfCall(E:\wamp\www\TropicalSeo\Application.cfc:65):65
	at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
	at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
	at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
	at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607
	at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
	at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781
	at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:346):346
	at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:107):107
	at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18
	at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2255):2255
	at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2222):2222
	at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:315):315
	at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728):728
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305):305
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749):749
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487):487
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412):412
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339):339
	at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213):213
	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171):171
	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145):145
	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92):92
	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394):394
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243):243
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222):222
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123):123
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472):472
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171):171
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99):99
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407):407
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004):1004
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589):589
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310):310
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source):-1
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1
	at java.lang.Thread.run(Unknown Source):-1

This error happens only in chrome. I’ve tried with firefox and internet explorer, both works great.

Hmm, that error was reported today on the ContentBox list as well. What version of Railo are you using? The error appears to be coming from the built-in cfdump tag and based on the stacktrace, I’m guessing you’re trying to dump out an ORM object. Is there any change that the dump is happening after the session has been flushed?

This may be a Railo bug. The cfdump tag in Railo is a regular unencrypted CFC that you can edit. (E:\railo\lib\railo-server\context\library\tag\Dump.cfc) You may be able to debug what it’s dumping.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Probably I’ve found what causes this exception. In my script I create a huge session, a session fullfilled of object. If I try to create a session with a more simple structure it works great.

So my question is: it’s possible to store in a session an array of object? or this will cause problem?

you can put anything in a session.

an array of hundreds of ORM objects with a deep association structure could be problematic.

test this out by adding objects into the session.

ORM just a good job at caching. if youre using the session to cache, dont. store the ID in the session and fetch when needed.

HI Aaron,

thanks for your help. I’m not sure what causes this, but I’m making my supposition.

The problem came out with a coldbox module called solitary, it’s in forgebox. The problem came out when I try to create a session with my user detail and also related roles. I think the problem is a function in the baseEntity.cfc that convert all the user property in struct:

public struct function toStruct(string exclude=""){
var data = {};
var props = getMetaData(this).properties;

for(var x=1; x <= arrayLen(props); x++){
// if we want to exclude properties from automatically getting set
// we can pass an exclude list user.toStruct(‘roles’);
if( listFindNoCase(arguments.exclude,props[x].name) == 0 ){
var method = this[“get” & props[x].name];
data["#props[x].name#"] = method();
}
}

return data;
}

I post this here because the creator of the module is in this forum, so he can give us help.

Probably if I parse the object in other way I could avoid this problem…but I’m not sure, because I really don’t understand what causes this.

oh ok. i would try/catch the eval call and see which property is throwing an error.