-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: could not initialize proxy - no Session
PostPosted: Sun Apr 03, 2016 12:36 pm 
Newbie

Joined: Fri Dec 08, 2006 5:44 pm
Posts: 13
Hi,

I am using Hibernate 3.6.10.Final. I have a huge app (9500 classes) built on Hibernate that runs fine. Recently a client requested that my screen show all records rather than a page at a time. There are no writes. All I changed was for the system to get all of the records (440) instead of a page (40). Now I am getting an error "could not initialize proxy - no Session". The session is not being closed until the end. The error is occurring when a lazy loaded element is accessed. This is what it seems is happening:

1. I spin through 440 records reading them into a list.

2. I go back through the list to get some internal elements (causing lazy loads). The session has not been closed until way after this.

When I read 40 records everything works fine. When I read 440 records I get the listed error on step 2.

It seems what is happening is that after X records Hibernate disconnects earlier records. Is that normal behavior? Am I missing something?

Any help would sure be appreciated.

Thanks!

Blake McBride


Top
 Profile  
 
 Post subject: Re: could not initialize proxy - no Session
PostPosted: Sun Apr 03, 2016 2:26 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
This is not a normal behavior at all. Unfortunately, you use a very old version, so even if it's a bug, I don't think there will be any 3.x releases any more.


Top
 Profile  
 
 Post subject: Re: could not initialize proxy - no Session
PostPosted: Sat Apr 09, 2016 6:34 pm 
Newbie

Joined: Fri Dec 08, 2006 5:44 pm
Posts: 13
Thanks! Could you please recommend some pointers to instructions on updating from 3.6.10 all the way to the current version?

Thanks!

Blake McBride


Top
 Profile  
 
 Post subject: Re: could not initialize proxy - no Session
PostPosted: Sun Apr 10, 2016 12:02 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Sure, you can do it in 2 steps:

1. Migrate 3 to 4
2. Migrate 4 to5


Top
 Profile  
 
 Post subject: Re: could not initialize proxy - no Session
PostPosted: Mon May 02, 2016 7:59 pm 
Newbie

Joined: Fri Dec 08, 2006 5:44 pm
Posts: 13
Okay, I updated from Hibernate 3.6.10.Final to 5.1.0.Final. I am still getting the same error. Here is what I am getting now:

Code:
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[WARN ] [internal.StatefulPersistenceContext] - HHH000179: Narrowing proxy to class com.arahant.beans.CompanyDetail - this operation breaks ==
[ERROR] [createTimesheetInvoice.CreateTimesheetInvoiceOps] - Error in com.arahant.services.standard.billing.createTimesheetInvoice.CreateTimesheetInvoiceOps.searchBillableTimesheets
[ERROR] [createTimesheetInvoice.CreateTimesheetInvoiceOps] - could not initialize proxy - no Session
[ERROR] [createTimesheetInvoice.CreateTimesheetInvoiceOps] - org.hibernate.LazyInitializationException: could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:147)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:260)
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:68)
   at com.arahant.beans.Employee_$$_jvst270_42.getFname(Employee_$$_jvst270_42.java)
   at com.arahant.business.BTimesheet.getFirstName(BTimesheet.java:484)
   at com.arahant.services.standard.billing.createTimesheetInvoice.SearchBillableTimesheetsReturnItem.<init>(SearchBillableTimesheetsReturnItem.java:32)
   at com.arahant.services.standard.billing.createTimesheetInvoice.SearchBillableTimesheetsReturn.setItem(SearchBillableTimesheetsReturn.java:42)
   at com.arahant.services.standard.billing.createTimesheetInvoice.CreateTimesheetInvoiceOps.searchBillableTimesheets(CreateTimesheetInvoiceOps.java:143)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:497)
   at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:250)
   at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:149)
   at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:94)
   at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:961)
   at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910)
   at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873)
   at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775)
   at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:386)
   at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:640)
   at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:263)
   at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:218)
   at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
   at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
   at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:302)
   at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:170)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)
[ERROR] [createTimesheetInvoice.CreateTimesheetInvoiceOps] - 2016-05-02 18:57:39 org.hibernate.LazyInitializationException: could not initialize proxy - no Session
   at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:147)
   at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:260)
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:68)
   at com.arahant.beans.Employee_$$_jvst270_42.getFname(Employee_$$_jvst270_42.java)
   at com.arahant.business.BTimesheet.getFirstName(BTimesheet.java:484)
   at com.arahant.services.standard.billing.createTimesheetInvoice.SearchBillableTimesheetsReturnItem.<init>(SearchBillableTimesheetsReturnItem.java:32)
   at com.arahant.services.standard.billing.createTimesheetInvoice.SearchBillableTimesheetsReturn.setItem(SearchBillableTimesheetsReturn.java:42)
   at com.arahant.services.standard.billing.createTimesheetInvoice.CreateTimesheetInvoiceOps.searchBillableTimesheets(CreateTimesheetInvoiceOps.java:143)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:497)
   at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:250)
   at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:149)
   at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:94)
   at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:961)
   at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910)
   at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873)
   at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775)
   at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:386)
   at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:640)
   at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:263)
   at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:218)
   at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
   at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
   at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:302)
   at org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:170)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)


Really appreciate some pointers. I am quite lost.

Thanks!

Blake


Top
 Profile  
 
 Post subject: Re: could not initialize proxy - no Session
PostPosted: Sun May 08, 2016 10:01 pm 
Newbie

Joined: Fri Dec 08, 2006 5:44 pm
Posts: 13
Found the problem. Someone (many programmers built this system) put a clear() in a next() method so it would do a clear() every so many records!! So, there was no session on the clear()'ed records. Makes sense.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.