org.springframework.orm.jpa.JpaSystemException

org.hibernate.HibernateException: c; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions

Samebug tips0

There are no available Samebug tips for this exception. If you know how to solve this issue, help other users by writing a short tip.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web168

  • org.hibernate.HibernateException: c; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions
  • Unable to access lob stream; nested exception is org.hibernate.HibernateException: Unable to access lob stream
  • org.hibernate.PersistentObjectException: uninitialized proxy passed to persist(); nested exception is javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: uninitialized proxy passed to persist()
  • Stack trace

    • org.springframework.orm.jpa.JpaSystemException: org.hibernate.HibernateException: c; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:418) at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:37) at net.nationalpayment.cp20.scheduler.CreateEntityUtilityImpl.createTransaction(CreateEntityUtilityImpl.java:123) at net.nationalpayment.core.scheduler.ProcessMiscSchedule.processMisc(ProcessMiscSchedule.java:153) at net.nationalpayment.core.scheduler.ProcessDraftSchedule.processDraft(ProcessDraftSchedule.java:287) at net.nationalpayment.core.scheduler.ProcessEnrollmentImpl.processEnrollment(ProcessEnrollmentImpl.java:154) at net.nationalpayment.core.scheduler.ProcessEnrollmentImpl.run(ProcessEnrollmentImpl.java:81) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:859) at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) at com.sun.proxy.$Proxy55.persist(Unknown Source) ... 8 more Caused by: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions at org.hibernate.proxy.AbstractLazyInitializer.setSession(AbstractLazyInitializer.java:112) at org.hibernate.engine.internal.StatefulPersistenceContext.reassociateProxy(StatefulPersistenceContext.java:585) at org.hibernate.engine.internal.StatefulPersistenceContext.reassociateIfUninitializedProxy(StatefulPersistenceContext.java:545) at org.hibernate.event.internal.ProxyVisitor.processEntity(ProxyVisitor.java:49) at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:124) at org.hibernate.event.internal.WrapVisitor.processValue(WrapVisitor.java:125) at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76) at org.hibernate.event.internal.AbstractSaveEventListener.visitCollectionsBeforeSave(AbstractSaveEventListener.java:377) at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:279) at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:128) at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78) at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:725) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:701) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:705) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:853) ... 13 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Once, 1 month ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 11 months ago
    Unknown user
    Once, 1 year ago