-->
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.  [ 2 posts ] 
Author Message
 Post subject: illegally attempted to associate a proxy with two open Sessi
PostPosted: Fri Dec 02, 2005 8:54 am 
Newbie

Joined: Sat Oct 29, 2005 1:23 pm
Posts: 15
Location: England
Hibernate version:3.0

I have a deployed J2EE session bean that uses hibernate to access the database running on JBoss. This behaves normally when it is accessed by a single user, but when 2 concurrent users try to call it, I get the following HibernateException on an intermittent basis:

Quote:
org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions
at org.hibernate.proxy.AbstractLazyInitializer.setSession(AbstractLazyInitializer.java:68)
at org.hibernate.engine.PersistenceContext.reassociateProxy(PersistenceContext.java:485)
at org.hibernate.engine.PersistenceContext.reassociateIfUninitializedProxy(PersistenceContext.java:455)


The session bean gets an instance of the session factory in its ejbCreate method, as follows:
Code:
/**
* @ejb.create-method
* @ejb.transaction type="Required"
*/
public void ejbCreate() throws CreateException
{
   // Create hibernate session factory
   try
   {
      sessionFactory = new Configuration().configure().buildSessionFactory();
   }
   catch (HibernateException ex)
   {
      logger.error("HibernateException in method ejbCreate(). ", ex);
   }
}


I then use the session factory to create a session, within all methods within the session bean. In my scenario, a single method is being called simultaniously (or thereabouts) by both client applications.

Is this a known issue, or am I doing something silly?

_________________
Jamie Cash
eCommerce Consultancy Limited
The eSecurity Experts


Top
 Profile  
 
 Post subject: Fixed
PostPosted: Fri Dec 02, 2005 9:44 am 
Newbie

Joined: Sat Oct 29, 2005 1:23 pm
Posts: 15
Location: England
Fixed it. My domain facade was a singleton. This has been changed so that a new DomainFacade is created for every session (therefore a new session is created ofr every simultanious thread or application).

_________________
Jamie Cash
eCommerce Consultancy Limited
The eSecurity Experts


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