IllegalStateException: EntityManager is closed (on event sco
mschmidke Nov 28, 2007 7:14 AMSeam 2.0.GA
Hello all,
I am accessing Hibernate session via JPA delegate as suggested in chapter 8.4. So I have the following lines in my components.xml:
<persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/EntityManagerFactories/Argos3EJBPU" /> <factory name="session" scope="STATELESS" auto-create="true" value="#{entityManager.delegate}" />
This allows the Hibernate session to be injected into my Session Bean.
This worked very well for me until I first time used an EVENT scoped stateful session bean.
With the event scoped bean, there is a problem in the @Remove method (the method is empty, but Seam requires one to be there) which gives the following exception:
13:02:25,091 WARN [Component] Exception calling stateful session bean default @Remove method: aufgabenliste javax.ejb.EJBException: javax.el.ELException: Error reading 'delegate' on type org.jboss.seam.persistence.EntityManagerProxy at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) ... Caused by: javax.el.ELException: Error reading 'delegate' on type org.jboss.seam.persistence.EntityManagerProxy at javax.el.BeanELResolver.getValue(BeanELResolver.java:66) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53) at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64) at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53) at org.jboss.el.parser.AstValue.getValue(AstValue.java:67) at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112) at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1906) ... Caused by: java.lang.IllegalStateException: EntityManager is closed at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:42) at org.hibernate.ejb.AbstractEntityManagerImpl.getDelegate(AbstractEntityManagerImpl.java:570) at org.jboss.seam.persistence.EntityManagerProxy.getDelegate(EntityManagerProxy.java:95) ...
Am I doing something wrong or is this an error?
Marcus.