-->
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.  [ 3 posts ] 
Author Message
 Post subject: lock versus refresh: lock -> error; refresh -> works !
PostPosted: Fri May 21, 2004 8:23 am 
Beginner
Beginner

Joined: Sat Oct 18, 2003 10:19 am
Posts: 21
Location: Belgium
** Using Hibernate 2.1.1

Piece of my businness code to retrieve the contacts of a customer...
try {
Session session = PersistencySupport.getSession();
session.lock(customer, LockMode.NONE);
Hibernate.initialize(customer.getContacts());
for (Iterator iter = customer.getContacts().iterator(); iter.hasNext();) {
Contact contact = (Contact) iter.next();
Hibernate.initialize(contact.getCountry());
}

} catch(HibernateException e) {
String emsg = "Unable to retrieve contacts for " + customer;
log.error(emsg, e);
throw e;
}

When debugging i see that the iteration works for a few loops, but then the line :
Hibernate.initialize(contact.getCountry());
throws net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed

THE WEIRD THING : Changing the session.lock(customer, LockMode.NONE) to session.refresh(customer); and the problem is gone !!!???


The session is opened/closed vi a AOP and works fine for other much more complex pieces of business code. The session is stored as thread local in the PersistencySupport object.

Database is MSSQL2000

** mapping files :
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="be.domainnames.nextgen.model.Customer"
table="domainnames3.dbo.customers"
proxy="be.domainnames.nextgen.model.Customer"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="customerId"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="native">
</generator>
</id>

<version
name="version"
type="java.lang.Long"
column="version"
/>

<property

name="password"
type="java.lang.String"
update="true"
insert="true"
column="password"
/>

<property
name="username"
type="java.lang.String"
update="true"
insert="true"
column="username"
not-null="true"
unique="true"
/>

<set
name="roles"
table="domainnames3.dbo.UserRole"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="customerId"
/>

<many-to-many
class="be.domainnames.nextgen.model.Role"
column="roleId"
outer-join="auto"
/>

</set>

<set
name="contacts"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="customerId"
/>

<one-to-many
class="be.domainnames.nextgen.model.Contact"
/>
</set>

<set
name="orders"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="customerId"
/>

<one-to-many
class="be.domainnames.nextgen.model.Order"
/>
</set>

<set
name="hostAddresses"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="customerId"
/>

<one-to-many
class="be.domainnames.nextgen.model.HostAddress"
/>
</set>

<set
name="nameservers"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="customerId"
/>

<one-to-many
class="be.domainnames.nextgen.model.Nameserver"
/>
</set>

<set
name="mailExchangers"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="customerId"
/>

<one-to-many
class="be.domainnames.nextgen.model.MailExchanger"
/>
</set>

<property
name="hiddenKey"
type="java.lang.String"
update="true"
insert="true"
column="hiddenKey"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Customer.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="be.domainnames.nextgen.model.Contact"
table="domainnames3.dbo.contacts"
proxy="be.domainnames.nextgen.model.Contact"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="contactId"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="native">
</generator>
</id>

<property
name="city"
type="java.lang.String"
update="true"
insert="true"
column="city"
/>

<many-to-one
name="country"
class="be.domainnames.nextgen.model.Country"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="countryId"
not-null="true"
/>

<property
name="creationDt"
type="java.util.Date"
update="true"
insert="true"
column="creationDt"
/>

<many-to-one
name="customer"
class="be.domainnames.nextgen.model.Customer"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="customerId"
not-null="true"
/>

<property
name="customerContact"
type="java.lang.Boolean"
update="true"
insert="true"
column="isCustomer"
/>

<property
name="defaultBilling"
type="java.lang.Boolean"
update="true"
insert="true"
column="isDefaultBilling"
/>

<property
name="defaultLicensee"
type="java.lang.Boolean"
update="true"
insert="true"
column="isDefaultLicensee"
/>

<property
name="defaultTech"
type="java.lang.Boolean"
update="true"
insert="true"
column="isDefaultTech"
/>

<property
name="email"
type="java.lang.String"
update="true"
insert="true"
column="email"
/>

<property
name="fax"
type="java.lang.String"
update="true"
insert="true"
column="fax"
/>

<property
name="firstName"
type="java.lang.String"
update="true"
insert="true"
column="firstName"
/>

<property
name="language"
type="java.lang.String"
update="true"
insert="true"
column="language"
/>

<property
name="lastName"
type="java.lang.String"
update="true"
insert="true"
column="lastName"
/>

<property
name="licenseeHandle"
type="java.lang.String"
update="true"
insert="true"
column="licenseeHandle"
/>

<property
name="organisation"
type="java.lang.String"
update="true"
insert="true"
column="organisation"
/>

<property
name="street1"
type="java.lang.String"
update="true"
insert="true"
column="street1"
/>

<property
name="street2"
type="java.lang.String"
update="true"
insert="true"
column="street2"
/>

<property
name="techHandle"
type="java.lang.String"
update="true"
insert="true"
column="techHandle"
/>

<property
name="tel"
type="java.lang.String"
update="true"
insert="true"
column="tel"
/>

<property
name="vat"
type="java.lang.String"
update="true"
insert="true"
column="vat"
/>

<property
name="zipCode"
type="java.lang.String"
update="true"
insert="true"
column="zipCode"
/>

<property
name="deleted"
type="java.lang.Boolean"
update="true"
insert="true"
column="deleted"
/>

<property
name="allowPaylater"
type="java.lang.Boolean"
update="true"
insert="true"
column="allowPaylater"
/>

<property
name="reseller"
type="java.lang.Boolean"
update="true"
insert="true"
column="reseller"
/>

<set
name="domainsAsLicensee"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="licenseeId"
/>

<one-to-many
class="be.domainnames.nextgen.model.Domain"
/>
</set>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Contact.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="be.domainnames.nextgen.model.Country"
table="countries"
proxy="be.domainnames.nextgen.model.Country"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="countryId"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="native">
</generator>
</id>

<property
name="country"
type="java.lang.String"
update="true"
insert="true"
column="country"
/>

<property
name="invoiceText"
type="java.lang.String"
update="true"
insert="true"
column="invoiceVATText"
/>

<property
name="vat"
type="java.math.BigDecimal"
update="true"
insert="true"
column="invoiceVAT"
/>

<property
name="countryCode"
type="java.lang.String"
update="true"
insert="true"
column="countryCode"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Country.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

_________________
Koen Maes
Leuven, Belgium


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 5:48 am 
Beginner
Beginner

Joined: Sat Oct 18, 2003 10:19 am
Posts: 21
Location: Belgium
Hi again,


I'm further investigating my problem; I've put some logging on :
log4j.logger.net.sf.hibernate.impl=debug

When using session.lock(customer, LockMode), the error says the owning session is closed when i access a member collection ! This does not happen using session.refresh(customer) ?????

*******************************************************************************************************
When using session.lock(customer, LockMode), here's the log :
*******************************************************************************************************

10:45:02,272 DEBUG SessionImpl:528 - opened session
10:45:02,274 DEBUG TransactionAspect:113 - transaction level: 1
10:45:02,276 DEBUG SessionImpl:1609 - reassociating transient instance: [be.domainnames.nextgen.model.Customer#1548]
10:45:02,284 ERROR CustomerFacadeImpl:54 - Unable to retrieve contact be.domainnames.nextgen.model.Contact id=<13310> for customer lvanmullem
net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:47)
at net.sf.hibernate.Hibernate.initialize(Hibernate.java:252)
at be.domainnames.nextgen.business.CustomerFacadeImpl.loadContacts(CustomerFacadeImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at be.domainnames.nextgen.aop.AspectManager.invoke(AspectManager.java:88)
at $Proxy13.loadContacts(Unknown Source)
at be.domainnames.nextgen.aop.OrderSupport.recalculate(OrderSupport.java:352)
at be.domainnames.nextgen.aop.OrderSupport.securityCheck(OrderSupport.java:188)
at be.domainnames.nextgen.aop.OrderSupport.start(OrderSupport.java:121)
at be.domainnames.nextgen.web.CustomActionServlet.service(CustomActionServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
10:45:02,299 INFO NextgenRuntimeException:32 - Exception of type <be.domainnames.nextgen.exception.InternalServerException> thrown. Message = <Unable to retrieve contact be.domainnames.nextgen.model.Contact id=<13310> for customer lvanmullem>.
be.domainnames.nextgen.exception.InternalServerException: Unable to retrieve contact be.domainnames.nextgen.model.Contact id=<13310> for customer lvanmullem
at be.domainnames.nextgen.business.CustomerFacadeImpl.loadContacts(CustomerFacadeImpl.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at be.domainnames.nextgen.aop.AspectManager.invoke(AspectManager.java:88)
at $Proxy13.loadContacts(Unknown Source)
at be.domainnames.nextgen.aop.OrderSupport.recalculate(OrderSupport.java:352)
at be.domainnames.nextgen.aop.OrderSupport.securityCheck(OrderSupport.java:188)
at be.domainnames.nextgen.aop.OrderSupport.start(OrderSupport.java:121)
at be.domainnames.nextgen.web.CustomActionServlet.service(CustomActionServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
Caused by: net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:47)
at net.sf.hibernate.Hibernate.initialize(Hibernate.java:252)
at be.domainnames.nextgen.business.CustomerFacadeImpl.loadContacts(CustomerFacadeImpl.java:50)
... 45 more
10:45:02,301 INFO NextgenRuntimeException:33 - Caused by :
net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:47)
at net.sf.hibernate.Hibernate.initialize(Hibernate.java:252)
at be.domainnames.nextgen.business.CustomerFacadeImpl.loadContacts(CustomerFacadeImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at be.domainnames.nextgen.aop.AspectManager.invoke(AspectManager.java:88)
at $Proxy13.loadContacts(Unknown Source)
at be.domainnames.nextgen.aop.OrderSupport.recalculate(OrderSupport.java:352)
at be.domainnames.nextgen.aop.OrderSupport.securityCheck(OrderSupport.java:188)
at be.domainnames.nextgen.aop.OrderSupport.start(OrderSupport.java:121)
at be.domainnames.nextgen.web.CustomActionServlet.service(CustomActionServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
10:45:02,308 DEBUG SessionImpl:3239 - running Session.finalize()
10:45:02,310 INFO AspectManager:100 - Business facade be.domainnames.nextgen.business.OrderFacadeImpl> threw exception <be.domainnames.nextgen.exception.InternalServerException>
be.domainnames.nextgen.exception.InternalServerException: Unable to retrieve contact be.domainnames.nextgen.model.Contact id=<13310> for customer lvanmullem
at be.domainnames.nextgen.business.CustomerFacadeImpl.loadContacts(CustomerFacadeImpl.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at be.domainnames.nextgen.aop.AspectManager.invoke(AspectManager.java:88)
at $Proxy13.loadContacts(Unknown Source)
at be.domainnames.nextgen.aop.OrderSupport.recalculate(OrderSupport.java:352)
at be.domainnames.nextgen.aop.OrderSupport.securityCheck(OrderSupport.java:188)
at be.domainnames.nextgen.aop.OrderSupport.start(OrderSupport.java:121)
at be.domainnames.nextgen.web.CustomActionServlet.service(CustomActionServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:182)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:309)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:387)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
Caused by: net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.java:47)
at net.sf.hibernate.Hibernate.initialize(Hibernate.java:252)
at be.domainnames.nextgen.business.CustomerFacadeImpl.loadContacts(CustomerFacadeImpl.java:50)
... 45 more
10:45:02,313 DEBUG TransactionAspect:141 - transaction level: 0
10:45:02,315 DEBUG SessionImpl:558 - transaction completion
10:45:02,316 DEBUG SessionImpl:546 - closing session
10:45:02,317 DEBUG SessionImpl:3187 - disconnecting session
10:45:02,331 DEBUG SessionImpl:558 - transaction completion


******************************************************************************
When using session.refresh(customer), everything works fine !

*******************************************************************************

11:28:17,634 DEBUG SessionImpl:558 - transaction completion
11:28:17,636 DEBUG SessionImpl:528 - opened session
11:28:17,637 DEBUG TransactionAspect:117 - transaction level: 1
11:28:17,638 DEBUG SessionImpl:1609 - reassociating transient instance: [be.domainnames.nextgen.model.Customer#1548]
11:28:17,640 DEBUG TransactionAspect:141 - transaction level: 0
11:28:17,642 DEBUG SessionImpl:2193 - flushing session
11:28:17,644 DEBUG SessionImpl:2321 - Flushing entities and processing referenced collections
11:28:17,646 DEBUG SessionImpl:2768 - Collection found: [be.domainnames.nextgen.model.Customer.roles#1548], was: [be.domainnames.nextgen.model.Customer.role
s#1548]
11:28:17,648 DEBUG SessionImpl:2768 - Collection found: [be.domainnames.nextgen.model.Customer.contacts#1548], was: [be.domainnames.nextgen.model.Customer.c
ontacts#1548]
11:28:17,649 DEBUG SessionImpl:2768 - Collection found: [be.domainnames.nextgen.model.Customer.orders#1548], was: [be.domainnames.nextgen.model.Customer.ord
ers#1548]
11:28:17,652 DEBUG SessionImpl:2768 - Collection found: [be.domainnames.nextgen.model.Customer.hostAddresses#1548], was: [be.domainnames.nextgen.model.Custo
mer.hostAddresses#1548]
11:28:17,655 DEBUG SessionImpl:2768 - Collection found: [be.domainnames.nextgen.model.Customer.nameservers#1548], was: [be.domainnames.nextgen.model.Custome
r.nameservers#1548]
11:28:17,656 DEBUG SessionImpl:2768 - Collection found: [be.domainnames.nextgen.model.Customer.mailExchangers#1548], was: [be.domainnames.nextgen.model.Cust
omer.mailExchangers#1548]
11:28:17,657 DEBUG SessionImpl:2664 - Processing unreferenced collections
11:28:17,658 DEBUG SessionImpl:2678 - Scheduling collection removes/(re)creates/updates
11:28:17,659 DEBUG SessionImpl:2217 - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
11:28:17,660 DEBUG SessionImpl:2222 - Flushed: 0 (re)creations, 0 updates, 0 removals to 6 collections
11:28:17,661 DEBUG Printer:75 - listing entities:
11:28:17,664 DEBUG Printer:82 - be.domainnames.nextgen.model.Customer{password=ykew94i901, contacts=[Contact#10649, Contact#12198, Contact#11903, Contact#13
969, Contact#12061, Contact#12980, Contact#13310, Contact#13641, Contact#14287, Contact#12840, Contact#12831, Contact#13681, Contact#13814, Contact#12394, C
ontact#12376, Contact#11752, Contact#15145, Contact#10453, Contact#11381, Contact#15218, Contact#15144, Contact#14802, Contact#13870, Contact#12416, Contact
#14771, Contact#12295, Contact#11379, Contact#11360, Contact#11336, Contact#15141, Contact#14353, Contact#11221, Contact#14870, Contact#11751, Contact#11136
, Contact#15119, Contact#10474, Contact#12084, Contact#13616], nameservers=uninitialized, orders=uninitialized, username=lvanmullem, roles=[Role#39], hidden
Key=115364333031, mailExchangers=uninitialized, id=1548, hostAddresses=uninitialized, version=6}
11:28:17,665 DEBUG SessionImpl:2258 - executing flush
11:28:17,666 DEBUG SessionImpl:2708 - post flush
11:28:17,668 DEBUG SessionImpl:558 - transaction completion
11:28:17,669 DEBUG SessionImpl:546 - closing session
11:28:17,669 DEBUG SessionImpl:3187 - disconnecting session
11:28:17,684 DEBUG SessionImpl:558 - transaction completion


Anybody any hint ???


thx !

_________________
Koen Maes
Leuven, Belgium


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 11:29 am 
Beginner
Beginner

Joined: Sat Oct 18, 2003 10:19 am
Posts: 21
Location: Belgium
I upgraded to Hibernate 2.1.3

The problem is still there but the error message slightly changed to disconnected session

17:12:27,343 ERROR ContactsFacadeImpl:71 - Unable to retrieve contact be.domainnames.nextgen.model.Contact id=<10649> for lvanmullem
net.sf.hibernate.HibernateException: disconnected session
at et.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:335)
at net.sf.hibernate.Hibernate.initialize(Hibernate.java:256)

Also noticed :
1) only for longer lists
2) sometimes not the first 1, 2 times I try, but after a few times.
3) the exception is thrown half way initialising the list !

I open/close the session in a AOP framework and I turned debug on the Transaction Aspect on ... it looks ok.

17:12:14,766 DEBUG TransactionAspect:36 - Aspect BEFORE : class java.lang.reflect.Method.loadContacts
17:12:14,767 DEBUG PersistencySupport:50 - creating session factory
17:12:14,769 DEBUG TransactionAspect:47 - transaction not running, starting a new one
17:12:14,771 DEBUG TransactionAspect:122 - transaction level: 1
<........execution of loadContacts .........>
17:12:15,023 DEBUG TransactionAspect:70 - Aspect AFTER : class java.lang.reflect.Method.loadContacts
17:12:15,024 DEBUG TransactionAspect:150 - transaction level: 0
17:12:15,026 DEBUG TransactionAspect:84 - committing the transaction
17:12:15,058 DEBUG PersistencySupport:107 - releasing session


Moreover, I put breakpoints on SessionImpl in the close() and any related member function.
The session is not being closed, AFAIK ?

Any help very much appreciated !

_________________
Koen Maes
Leuven, Belgium


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.