-->
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: Illegal attempt to associate a collection with two open sess
PostPosted: Thu Feb 16, 2006 9:12 am 
Newbie

Joined: Thu Feb 16, 2006 9:07 am
Posts: 4
Hallo,

arbeite seit kurzem mit Hibernate 3. Bekomme eine für mich nicht erklärliche Fehlermeldung:

Illegal attempt to associate a collection with two open sessions

Weiss aber nicht, wie das passieren kann. Was bedeutet diese Fehlermeldung überhaupt? Was könnte denn diesen Fehler verursacht haben?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 9:55 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Kannst Du bitte mal nen Stacktrace und Code Snippets posten.

Sieht so aus, als ob Du parallel mit 2 offenen Sessions arbeitest.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 11:11 am 
Newbie

Joined: Thu Feb 16, 2006 9:07 am
Posts: 4
Das ist der Stacktrace:

2006-02-14 10:41:53,447: [AJPRequestHandler-ApplicationServerThread-5] PatentDbException, ERROR, de.oc.clariant.pm.orm.exception.PatentDbException: Error Code: 12
Patentfamily could not be bound to Hibernate Session
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:237)
at org.hibernate.event.def.OnLockVisitor.processCollection(OnLockVisitor.java:40)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64)
at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58)
at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:129)
at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:75)
at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:57)
at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:508)
at de.oc.clariant.pm.orm.dao.PatentFamilyDao.bindPatentFamily(PatentFamilyDao.java:45)
at de.oc.clariant.pm.jsf.backing.Patentfamily.getCurrentPatentfamily(Patentfamily.java:528)
at de.oc.clariant.pm.jsf.backing.Patentcountry.getPatentCountriesList(Patentcountry.java:53)
at sun.reflect.GeneratedMethodAccessor1647.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
at javax.faces.component.UIData.getValue(UIData.java:527)
at javax.faces.component.UIData.getDataModel(UIData.java:856)
at javax.faces.component.UIData.setRowIndex(UIData.java:379)
at javax.faces.component.UIData.iterate(UIData.java:898)
at javax.faces.component.UIData.processDecodes(UIData.java:737)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at de.oc.clariant.pm.jsf.servletfilters.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:31)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:92)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)


Und hier der Code, wo der Fehler passiert:

public void bindPatentFamily(Patentfamily family) throws PatentDbException
{
log.debug("bindPatentFamily");
try
{
//Holt session über ThreadlocalObjekt
Session session = openSession();
//Setzt lock, damit ich lazy auf Collections zugreifen kann
session.lock(family,LockMode.NONE);
}
catch (Exception ex)
{
throw new PatentDbException(12,"Patentfamily could not be bound to Hibernate Session",ex);
}
}


Das Problem ist, dass ich den Fehler nicht reproduzieren kann. Beim Testen ist das nie passiert...

2 offene Sessions kann eigentlich nicht sein, da ich mit einem Servlet-Filter arbeite, der die Session nach dem Request immer schliesst. Die Hibernate-Session ist an den Thread gebunden, so dass eigentlich nichts passieren kann...

Kann es sein, dass ein User sich unter Umständen in unterschiedlichen Threads aufhalten kann? Denn zur Zeit wird angenommen, dass der User immer im selben Thread des Application Servers (Oracle) ist .


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.