13 Replies Latest reply on Jun 26, 2009 12:06 AM by andyredhead

    Closed EntityManager injected into generics based DAO

    andyredhead

      Hi,


      I have stumbled across some strange (to me) behavior in Seam - if I use a DAO based on java generics and inheritance I end up with a closed entity manager being injected into my DAO, if use basically the same code without generics and inheritance then everything works ok... ???


      I'll explain what I'm trying to do.


      I have a set of JPA entities and stateless session bean data access objects (DAOs) which I want to use from both within seam and from non-seam ejb3 applications (both within a JBoss 4.2 appserver running in Java 6).


      To prevent any seam dependencies leaking into the straight ejb3 apps, I'm defining the seam components using seam component xml files. To get seam to manage the entitymanager, I have seam configured to look-up the entity manager from the appserver JNDI.


      To test my setup I have a very simple Entity, corresponding DAO and a simple action statful session bean with a couple of xhtml facelets based pages that let me type in a text value, save a new entity with that text value then go back and create another one.


      With the simple DAO I can loop round and round, creating new instances then viewing the result (and I can see the instances ending up in the database) - so it all works ok :)


      With the generics and inheritance based DAO, the first loop round succeeds but the second loop fails - the exception is:




      2009-06-24 15:51:25,397 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] creating new egrefdata
      2009-06-24 15:51:25,398 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] makePersistent - using entity manager: org.jboss.seam.persistence.EntityManagerProxy@458e29
      2009-06-24 15:51:25,404 ERROR [javax.enterprise.resource.webcontainer.jsf.application] [http-127.0.0.1-8080-1] [] javax.ejb.EJBTransactionRolledbackException: EntityManager is closed
      javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: EntityManager is closed
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)




      I have the complete log files for both scenarios and I'm quite happy to share those and the source code (if anyone would like to see it).


      I'm pretty certain that its not the environment or the xml configuration thats at fault because the simple implementation is running in the same environment and is also configured using component.xml files.


      I've run out of things to look into and would appreciate any thoughts or points.


      Cheers,


      Andy

        • 1. Re: Closed EntityManager injected into generics based DAO
          swd847

          Can you post the code?

          • 2. Re: Closed EntityManager injected into generics based DAO
            andyredhead

            Will do - am away on a customer site today, I'll post it when i get home this evening.

            • 3. Re: Closed EntityManager injected into generics based DAO
              andyredhead
              Hi,

              There is quite a lot of information in the following posts - appologies if I've been overly verbose!

              One detail that has caught my eye is that in the log files for the successful create there are lines saying that the entity manager is being set to a value and subsequently set to null whereas in the unsucessful version the entity manager is never set back to null...

              Below I've added:
              `
              1) The seam "action" stateless session bean
                1a] action class - simple DAO version
                1b] action class - generic DAO version

              2) pages.xml fragment (controls the surrounding Seam conversation)

              3) Simple DAO code
                3a] simple dao bean
                3b] simple dao component.xml

              4) Description of the DAO pattern I'm trying to use

              5) Generic DAO Interface

              6) Specific DAO Interface

              7) Abstract class impementation of generic dao

              8) Concrete implementation of the DAO

              9) component.xml for the generic DAO

              10) Standard entity interface

              11) JPA entity implementation

              12) Logs
                12a] successful (non-generic version) 
                12b] failing on 2nd save (generic version)
              `

              • 4. Re: Closed EntityManager injected into generics based DAO
                andyredhead
                1) The seam "action" stateless session bean (this one works)
                `
                1A] action class - simple DAO version

                @Stateful
                @Name(value="TestNewRefDataActionBean")
                public class TestNewRefDataActionBean implements TestNewRefDataAction {

                        @Logger
                        Log _log;

                        @Resource
                        SessionContext _ejbSessionCtx;
                       
                        protected String _newRefDataLabel = "";
                       
                        protected EgRefData _newEgRefData;

                //      @In(value="seamMokshaEntityManager")
                //      EntityManager _em;

                //      @In(value="EgRefDataDao", create=true)
                //      EgRefDataDao egRefDataDao;
                       
                        @In(value="SeamTestEgRefDataDaoBean", create=true)
                        TestEgRefDataDao _testEgRefDataDao;
                        //EgRefDataDao _testEgRefDataDao;
                       
                        @Override
                        public EgRefData getCreatedRefData() {
                                return _newEgRefData;
                        }

                        @Override
                        public String getNewRefdataLabel() {
                                return _newRefDataLabel;
                        }

                        @Override
                        @Remove
                        public void remove() {
                                // just keeping Seam happy
                        }

                        @Override
                        public void setNewRefdataLabel(String label) {
                                _newRefDataLabel = label;
                        }

                        public String createNewEgRefdata() {
                                String retView = "";
                               
                                _log.debug("creating new egrefdata");
                               

                                //EgRefData holderEgRefData = egRefDataDao.newInstance();
                                //EgRefData holderEgRefData = new PostgreSqlEgRefDataEntity();
                                EgRefData holderEgRefData = _testEgRefDataDao.newInstance();
                               
                                holderEgRefData.setRefDataLabel(_newRefDataLabel);
                               
                                //_newEgRefData = egRefDataDao.makePersistent(holderEgRefData);
                                //_newEgRefData = _em.merge(holderEgRefData);
                                _newEgRefData = _testEgRefDataDao.makePersistent(holderEgRefData);
                               
                                retView = "ok";

                                //egRefDataDao.flushExtendedPersistenceContext();
                                //_em.flush();
                                _testEgRefDataDao.flush();
                                //_testEgRefDataDao.flushExtendedPersistenceContext();
                               
                                _log.debug("returning: " + retView);
                               
                                return retView;
                        }

                }
                `

                `
                1B] action class - generic DAO version


                @Stateful
                @Name(value="TestNewRefDataActionBean")
                public class TestNewRefDataActionBean implements TestNewRefDataAction {

                        @Logger
                        Log _log;

                        @Resource
                        SessionContext _ejbSessionCtx;
                       
                        protected String _newRefDataLabel = "";
                       
                        protected EgRefData _newEgRefData;

                //      @In(value="seamMokshaEntityManager")
                //      EntityManager _em;

                //      @In(value="EgRefDataDao", create=true)
                //      EgRefDataDao egRefDataDao;
                       
                        @In(value="SeamTestEgRefDataDaoBean", create=true)
                        //TestEgRefDataDao _testEgRefDataDao;
                        EgRefDataDao _testEgRefDataDao;
                       
                        @Override
                        public EgRefData getCreatedRefData() {
                                return _newEgRefData;
                        }

                        @Override
                        public String getNewRefdataLabel() {
                                return _newRefDataLabel;
                        }

                        @Override
                        @Remove
                        public void remove() {
                                // just keeping Seam happy
                        }

                        @Override
                        public void setNewRefdataLabel(String label) {
                                _newRefDataLabel = label;
                        }

                        public String createNewEgRefdata() {
                                String retView = "";
                               
                                _log.debug("creating new egrefdata");
                               

                                //EgRefData holderEgRefData = egRefDataDao.newInstance();
                                //EgRefData holderEgRefData = new PostgreSqlEgRefDataEntity();
                                EgRefData holderEgRefData = _testEgRefDataDao.newInstance();
                               
                                holderEgRefData.setRefDataLabel(_newRefDataLabel);
                               
                                //_newEgRefData = egRefDataDao.makePersistent(holderEgRefData);
                                //_newEgRefData = _em.merge(holderEgRefData);
                                _newEgRefData = _testEgRefDataDao.makePersistent(holderEgRefData);
                               
                                retView = "ok";

                                //egRefDataDao.flushExtendedPersistenceContext();
                                //_em.flush();
                                //_testEgRefDataDao.flush();
                                _testEgRefDataDao.flushExtendedPersistenceContext();
                               
                                _log.debug("returning: " + retView);
                               
                                return retView;
                        }

                }
                `
                • 5. Re: Closed EntityManager injected into generics based DAO
                  andyredhead
                  2) pages.xml
                  
                      <page view-id="/app/add-refdata/new-values.xhtml">
                      
                          <begin-conversation flush-mode="manual"/>
                          <!-- begin-conversation /-->
                          
                          <navigation from-action="#{TestNewRefDataActionBean.createNewEgRefdata}">
                          
                                  <rule if-outcome="ok" >           
                                          <redirect view-id="/app/add-refdata/view-new-refdata.xhtml"/>
                                  </rule>
                          
                                  <rule if-outcome="fail">
                                          <redirect view-id="/app/add-refdata/new-refdata-error.xhtml"/>
                                  </rule>
                                  <rule>
                                          <redirect view-id="/app/nav-fallthrough.xhtml"/>
                                  </rule>           
                          </navigation>
                      </page>
                  
                          <page view-id="/app/add-refdata/view-new-refdata.xhtml">                  
                                  <end-conversation />
                          </page>
                  


                          

                  • 6. Re: Closed EntityManager injected into generics based DAO
                    andyredhead
                    3) Simple DAO Code
                    3a] simple dao Bean
                    
                    
                    @Stateless
                    //@Scope(ScopeType.CONVERSATION)
                    //@Name("SeamTestEgRefDataDaoBean")
                    public class TestEgRefDataDaoBean implements TestEgRefDataDao {
                    
                         @Logger
                         Log _log;
                         
                         
                         EntityManager _em;
                         
                         @Override
                         @Remove
                         public void remove() {
                              // keeping seam happy
                         }
                    
                         public EntityManager getEntityManager() {
                              return _em;
                         }
                         
                         @In(value="seamMokshaEntityManager")
                         public void setEntityManager(EntityManager entityManager) {
                              _log.debug("setting entity manager to: " + entityManager);
                              _em = entityManager;
                         }
                         
                         public EgRefData newInstance() {
                              return new PostgreSqlEgRefDataEntity();
                         }
                         
                         public EgRefData makePersistent(EgRefData persistMe) {
                              _log.debug("persisting using em: " + _em);
                              return _em.merge(persistMe);
                         }
                         
                         public EgRefData findByPk(Long id) {
                              _log.info("finding: " + id + " using em: " + _em);
                              return _em.find(EgRefData.class, id);
                         }
                    
                         public void flush() {
                              _log.debug("flushing em: " + _em);
                              _em.flush();
                         }
                         
                    }
                    


                    • 7. Re: Closed EntityManager injected into generics based DAO
                      andyredhead
                      3b] simple dao component.xml
                      
                      <component xmlns="http://jboss.com/products/seam/components"
                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd"
                                name="SeamTestEgRefDataDaoBean" 
                                class="net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean"
                                >
                           <!--  -->
                           
                           <property name="entity-manager">#{seamMokshaEntityManager}</property>
                           
                      </component>
                      

                      • 8. Re: Closed EntityManager injected into generics based DAO
                        andyredhead

                        4) DAO pattern


                        Based on a pattern in Christian Bauers book Java Persistence in Hibernate.


                        The idea is that the application logic code only works with interfaces
                        for DAO and Entity objects. A particular implementaion of those interfaces
                        is injected at runtime...


                                             _________________________       __________________
                                                  | <Interface>             |     | <Abstract Class> |
                                                  | GenericDao              |     | JpaGenericDao    |
                                             |        findById         |<----|                  |
                                                  |        makePersistent   |     |                  |
                                                  |            makeTransient    |     |                  |
                                                  |            newInstance     |     |                  |
                                                                /\                           /\
                                                                |                            |
                         __________________       ________|_________________      _____|_________
                        | <Interface>      |o----| <Interface>             |     | <Class>       |
                        | DomainEntityBlah |     | ActualDaoInterface      |<----| ActualDaoBean |
                                  /\             |    someSpecificMethod() |     |               |
                                  |
                        __________|_________        
                        | <Class>          | 
                        | JpaEntityImplBlah|
                        

                        • 9. Re: Closed EntityManager injected into generics based DAO
                          andyredhead
                          5) Generic DAO Interface
                          
                          
                          public interface GenericDao<DOM> {
                               
                               /**
                                * Find the persistent instance with pk value 'id'
                                * @param id primary key
                                * @return the persistant instance
                                */
                               DOM findById(Serializable id);
                               
                               /**
                                * Make this entity instance persistent by inserting into db.
                                * 
                                * @param entity save me.
                                * @return
                                */
                               DOM makePersistent(DOM entity);
                               
                               /**
                                * Make this persistent entity transient (delete the relevant entries from persistent storage).
                                * 
                                * @param entity delete me.
                                */
                               void makeTransient(DOM entity);
                               
                               /**
                                * Obtain a new transient instance of an implementation of type DOM.
                                * 
                                * Using this method rather than java new ... means that the caller
                                * knows nothing about the underlying implementation.
                                *  
                                * @return
                                */
                               public DOM newInstance();
                               
                               /**
                                * Send stored statements to db (for use with something like a Seam managed persistence unit in a Seam conversation).
                                */
                               public void flushExtendedPersistenceContext();
                               
                          }
                          

                          • 10. Re: Closed EntityManager injected into generics based DAO
                            andyredhead

                            6) Specific DAO Interface


                            (doesnt do much, it is a simple test case...)


                            @Local
                            public interface EgRefDataDao extends GenericDao<EgRefData> {
                            
                                 //public void remove();
                                 
                            }
                            



                            7) Abstract class impementation of generic dao


                            public abstract class GenericDaoJpa<DOM, ENT, ID extends Serializable> implements GenericDao<DOM> {
                            
                                 private static Logger _log = Logger.getLogger(GenericDaoJpa.class);
                            
                                 
                                protected Class<DOM> _domainInterfaceTypeClass;
                            
                                protected Class<ENT> _jpaEntityTypeClass;
                            
                                protected Class<ID> _jpaEntityPkType;
                                
                                 
                                 
                                 
                                 //
                                 protected EntityManager entityManager;
                            
                                 protected GenericDaoJpa() {
                                      
                                    Type[] allTypesArray = ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments();
                            
                                    if (allTypesArray == null) {
                                        throw new RuntimeException("The generic supertypes array is null! (This can only happen if the DAO has been incorrectly implemented)");
                                    }
                            
                                    if (allTypesArray.length != 3) {
                                        throw new RuntimeException("The generic supertypes array does not have 3 elements!"
                                                + " (This can only happen if the DAO has been incorrectly implemented)"
                                                + " [0] DOM Domain Interface, [1] ENT Entity Implementation Type, [2] ID Entity primary key type");
                                    }
                            
                                    if (_log.isDebugEnabled()) {
                                         _log.debug("in constructor...");
                            
                                        _log.debug("Generic types count: " + allTypesArray.length);
                                        for (int yy = 0; yy < allTypesArray.length; yy++) {
                                             _log.debug("\tType: " + yy + " is: " + allTypesArray[yy]);
                                        }
                                        _log.debug("constructor finished.");
                                    }
                            
                                    _domainInterfaceTypeClass = (Class<DOM>) allTypesArray[0];
                            
                                    _jpaEntityTypeClass = (Class<ENT>) allTypesArray[1];
                            
                                    _jpaEntityPkType = (Class<ID>) allTypesArray[2];
                                    
                                 }
                                 
                                 
                               /**
                                *
                                */
                               public DOM findById(final Serializable id) {
                                   DOM entity;
                            
                                   entity = (DOM) entityManager.find(_jpaEntityTypeClass, id);
                            
                                   return entity;
                               }
                            
                               public DOM makePersistent(final DOM entity) {
                                    
                                    if (_log.isDebugEnabled()) {
                                         _log.debug("makePersistent - using entity manager: " + entityManager);
                                    }
                                    
                                   return (DOM) entityManager.merge(((ENT)entity));
                               }
                            
                               public void makeTransient(final DOM entity) {
                                   entityManager.remove((ENT)entity);
                               }
                            
                               public DOM newInstance() {
                                   DOM newInst = null;
                            
                                   try {
                                       newInst = (DOM) _jpaEntityTypeClass.newInstance();
                                   } catch (Exception e) {
                                        _log.error("Problem creating new instance of type: " + _jpaEntityTypeClass + " as implementation of: "
                                                  + _domainInterfaceTypeClass, e);
                                   }
                            
                                   return newInst;
                               }
                            
                               
                               public EntityManager getEntityManager() {
                                    return entityManager;
                               }
                               
                                public void setEntityManager(EntityManager em) {
                                     if (_log.isDebugEnabled()) {
                                          _log.debug("setEntityManager - to em: " + em);
                                    }
                                     entityManager = em;
                                }
                            
                                public void flushExtendedPersistenceContext() {
                                     if (_log.isDebugEnabled()) {
                                           _log.debug("Flushing entity manager: " + entityManager);
                                      }
                                     entityManager.flush();
                                }
                            
                            }
                            

                            • 11. Re: Closed EntityManager injected into generics based DAO
                              andyredhead
                              8) Concrete implementation of the DAO
                              
                              @Stateless
                              public class PostgreSqlEgRefDataDaoBean extends GenericDaoJpa<EgRefData, PostgreSqlEgRefDataEntity, Long> implements EgRefDataDao {
                              
                                      //private static Logger _log = Logger.getLogger(PostgreSqlEgRefDataDaoBean.class);
                                  
                              }
                              



                              9) component.xml for the generic DAO
                              
                              <component xmlns="http://jboss.com/products/seam/components"
                                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                              xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd"
                                              name="SeamTestEgRefDataDaoBean" 
                                              class="net.sf.moksha.persistence.jpa.entity.postgresql.test.PostgreSqlEgRefDataDaoBean"
                                              
                                              >
                                      <!--  -->
                                      
                                      <property name="entity-manager">#{seamMokshaEntityManager}</property>
                                      
                              </component>
                              



                              10) Standard entity interface


                              public interface EgRefData extends CommonPersistentProperties {
                              
                                      public String getRefDataLabel();
                                      
                                      public void setRefDataLabel(String label);
                                      
                              }
                              




                              11) JPA entity implementation


                              @Entity
                              @Table(name="moksha_test_eg_refdata")
                              public class PostgreSqlEgRefDataEntity extends GenericJpaCommonPersistentProperties implements EgRefData {
                              
                                      
                                      protected Long _id;
                                      
                                      protected String _refDataLabel;
                                      
                                      
                                      //@Override
                                  @SequenceGenerator(sequenceName = "seq_pk_moksha_test_eg_refdata", name = "seqGen")
                                  @Id
                                  @Column(name = "eg_refdata_id")
                                  @GeneratedValue(generator = "seqGen")       
                                      public Long getPk() {
                                              return _id;
                                      }
                              
                                      //@Override
                                      public void setPk(Long pk) {
                                              _id = pk;
                                      }
                                      
                                      //@Override
                                      @Column(name = "eg_refdata_label", nullable = false)
                                      public String getRefDataLabel() {
                                              return _refDataLabel;
                                      }
                              
                                      //@Override
                                      public void setRefDataLabel(String label) {
                                              _refDataLabel = label;
                                      }
                              
                                      public String toString() {
                                              return "EgRefData - Id: " + _id + ", RefDataLabel: " + _refDataLabel;
                                      }
                                      
                                      /**
                                       * Only equal if labels are the same.
                                       */
                                      public boolean equals(Object obj) {
                                              boolean isEqual = false;
                                              
                                              if (obj != null) {
                                                      if (obj instanceof EgRefData) {
                                                              if (_refDataLabel != null) {
                                                                      if (_refDataLabel.equals(((EgRefData)obj).getRefDataLabel())) {
                                                                              isEqual = true;
                                                                      }
                                                              }
                                                      }
                                              }
                                              
                                              return isEqual;
                                      }
                                      
                              }
                              

                              • 12. Re: Closed EntityManager injected into generics based DAO
                                andyredhead

                                13) Logs


                                13a] successful (non-generic version)
                                
                                2009-06-24 16:44:11,928 INFO  [org.jboss.system.server.Server] [main] [] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 28s:266ms
                                2009-06-24 16:44:19,026 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                2009-06-24 16:44:19,142 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] No stored conversation
                                2009-06-24 16:44:19,177 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                2009-06-24 16:44:19,199 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                2009-06-24 16:44:19,205 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Beginning long-running conversation
                                2009-06-24 16:44:19,567 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 16:44:19 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp2170158757886392335moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
                                2009-06-24 16:44:19,602 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 16:44:19 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp2170158757886392335moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
                                2009-06-24 16:44:19,612 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 16:44:19 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp2170158757886392335moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
                                2009-06-24 16:44:19,633 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 16:44:19 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp2170158757886392335moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
                                2009-06-24 16:44:19,656 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 16:44:19 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp2170158757886392335moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
                                2009-06-24 16:44:19,667 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 16:44:19 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp2170158757886392335moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
                                2009-06-24 16:44:19,958 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                2009-06-24 16:44:19,963 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 1
                                2009-06-24 16:44:44,935 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                2009-06-24 16:44:44,943 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 1
                                2009-06-24 16:44:44,962 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] creating new egrefdata
                                2009-06-24 16:44:44,985 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Looking for a JTA transaction to join
                                2009-06-24 16:44:45,004 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Looking for a JTA transaction to join
                                2009-06-24 16:44:45,005 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Transaction already joined
                                2009-06-24 16:44:45,007 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@174f6ce
                                2009-06-24 16:44:45,011 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@174f6ce
                                2009-06-24 16:44:45,012 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: null
                                2009-06-24 16:44:45,018 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@174f6ce
                                2009-06-24 16:44:45,020 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] persisting using em: org.jboss.seam.persistence.EntityManagerProxy@174f6ce
                                2009-06-24 16:44:45,044 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: null
                                2009-06-24 16:44:45,047 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@174f6ce
                                2009-06-24 16:44:45,048 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] flushing em: org.jboss.seam.persistence.EntityManagerProxy@174f6ce
                                2009-06-24 16:44:45,070 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: null
                                2009-06-24 16:44:45,072 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] returning: ok
                                2009-06-24 16:44:45,076 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: INVOKE_APPLICATION 5
                                2009-06-24 16:44:45,107 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 1
                                2009-06-24 16:44:45,134 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                2009-06-24 16:44:45,138 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 1
                                2009-06-24 16:44:45,140 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                2009-06-24 16:44:45,145 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                2009-06-24 16:44:45,148 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Ending long-running conversation
                                2009-06-24 16:44:45,205 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                2009-06-24 16:44:45,209 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Discarding conversation state: 1
                                2009-06-24 16:44:55,842 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                2009-06-24 16:44:55,845 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] No stored conversation
                                2009-06-24 16:44:55,847 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                2009-06-24 16:44:55,850 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                2009-06-24 16:44:55,851 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Beginning long-running conversation
                                2009-06-24 16:44:55,866 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                2009-06-24 16:44:55,869 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 2
                                2009-06-24 16:45:03,183 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                2009-06-24 16:45:03,187 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 2
                                2009-06-24 16:45:03,194 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] creating new egrefdata
                                2009-06-24 16:45:03,195 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Looking for a JTA transaction to join
                                2009-06-24 16:45:03,196 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Looking for a JTA transaction to join
                                2009-06-24 16:45:03,196 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Transaction already joined
                                2009-06-24 16:45:03,196 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@1fdf894
                                2009-06-24 16:45:03,199 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: null
                                2009-06-24 16:45:03,199 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@1fdf894
                                2009-06-24 16:45:03,200 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] persisting using em: org.jboss.seam.persistence.EntityManagerProxy@1fdf894
                                2009-06-24 16:45:03,202 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: null
                                2009-06-24 16:45:03,202 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: org.jboss.seam.persistence.EntityManagerProxy@1fdf894
                                2009-06-24 16:45:03,203 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] flushing em: org.jboss.seam.persistence.EntityManagerProxy@1fdf894
                                2009-06-24 16:45:03,204 DEBUG [net.sf.moksha.test.seam.test.impl.TestEgRefDataDaoBean] [http-127.0.0.1-8080-1] [] setting entity manager to: null
                                2009-06-24 16:45:03,205 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] returning: ok
                                2009-06-24 16:45:03,207 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: INVOKE_APPLICATION 5
                                2009-06-24 16:45:03,214 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 2
                                2009-06-24 16:45:03,238 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                2009-06-24 16:45:03,242 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 2
                                2009-06-24 16:45:03,243 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                2009-06-24 16:45:03,245 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                2009-06-24 16:45:03,247 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Ending long-running conversation
                                2009-06-24 16:45:03,257 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                2009-06-24 16:45:03,260 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Discarding conversation state: 2
                                

                                • 13. Re: Closed EntityManager injected into generics based DAO
                                  andyredhead
                                  13b] failing on 2nd save (generic version)
                                  
                                  2009-06-24 15:47:08,617 INFO  [org.jboss.system.server.Server] [main] [] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 29s:654ms
                                  2009-06-24 15:50:40,197 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                  2009-06-24 15:50:40,341 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] No stored conversation
                                  2009-06-24 15:50:40,364 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                  2009-06-24 15:50:40,383 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                  2009-06-24 15:50:40,388 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Beginning long-running conversation
                                  2009-06-24 15:50:40,785 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 15:50:40 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                  INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp5116617335904695874moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
                                  2009-06-24 15:50:40,820 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 15:50:40 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                  INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp5116617335904695874moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
                                  2009-06-24 15:50:40,830 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 15:50:40 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                  INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp5116617335904695874moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
                                  2009-06-24 15:50:40,851 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 15:50:40 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                  INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp5116617335904695874moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
                                  2009-06-24 15:50:40,873 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 15:50:40 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                  INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp5116617335904695874moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
                                  2009-06-24 15:50:40,882 ERROR [STDERR] [http-127.0.0.1-8080-1] [] 24-Jun-2009 15:50:40 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                  INFO: Added Library from: jar:file:/C:/ar-work/devenv/testing/appserver2/jboss/server/moksha/tmp/deploy/tmp5116617335904695874moksha-app-seam-test.ear-contents/moksha-app-seam-test-exp.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
                                  2009-06-24 15:50:41,178 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                  2009-06-24 15:50:41,183 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 1
                                  2009-06-24 15:51:03,570 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                  2009-06-24 15:51:03,578 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 1
                                  2009-06-24 15:51:03,597 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] creating new egrefdata
                                  2009-06-24 15:51:03,601 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] in constructor...
                                  2009-06-24 15:51:03,603 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] Generic types count: 3
                                  2009-06-24 15:51:03,605 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] []      Type: 0 is: interface net.sf.moksha.persistence.model.data.test.EgRefData
                                  2009-06-24 15:51:03,608 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] []      Type: 1 is: class net.sf.moksha.persistence.jpa.entity.postgresql.test.PostgreSqlEgRefDataEntity
                                  2009-06-24 15:51:03,609 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] []      Type: 2 is: class java.lang.Long
                                  2009-06-24 15:51:03,611 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] constructor finished.
                                  2009-06-24 15:51:03,631 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Looking for a JTA transaction to join
                                  2009-06-24 15:51:03,649 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Looking for a JTA transaction to join
                                  2009-06-24 15:51:03,650 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] [http-127.0.0.1-8080-1] [] Transaction already joined
                                  2009-06-24 15:51:03,652 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] setEntityManager - to em: org.jboss.seam.persistence.EntityManagerProxy@458e29
                                  2009-06-24 15:51:03,656 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] makePersistent - using entity manager: org.jboss.seam.persistence.EntityManagerProxy@458e29
                                  2009-06-24 15:51:03,695 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] Flushing entity manager: org.jboss.seam.persistence.EntityManagerProxy@458e29
                                  2009-06-24 15:51:04,104 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] returning: ok
                                  2009-06-24 15:51:04,108 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: INVOKE_APPLICATION 5
                                  2009-06-24 15:51:04,154 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 1
                                  2009-06-24 15:51:04,181 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                  2009-06-24 15:51:04,186 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 1
                                  2009-06-24 15:51:04,189 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                  2009-06-24 15:51:04,193 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                  2009-06-24 15:51:04,197 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Ending long-running conversation
                                  2009-06-24 15:51:04,267 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                  2009-06-24 15:51:04,275 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Discarding conversation state: 1
                                  2009-06-24 15:51:17,392 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                  2009-06-24 15:51:17,396 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] No stored conversation
                                  2009-06-24 15:51:17,397 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RESTORE_VIEW 1
                                  2009-06-24 15:51:17,400 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RENDER_RESPONSE 6
                                  2009-06-24 15:51:17,402 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Beginning long-running conversation
                                  2009-06-24 15:51:17,417 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] committing transaction after phase: RENDER_RESPONSE 6
                                  2009-06-24 15:51:17,419 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Storing conversation state: 2
                                  2009-06-24 15:51:25,387 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] [http-127.0.0.1-8080-1] [] beginning transaction prior to phase: RESTORE_VIEW 1
                                  2009-06-24 15:51:25,390 DEBUG [org.jboss.seam.core.Manager] [http-127.0.0.1-8080-1] [] Restoring conversation with id: 2
                                  2009-06-24 15:51:25,397 DEBUG [net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean] [http-127.0.0.1-8080-1] [] creating new egrefdata
                                  2009-06-24 15:51:25,398 DEBUG [net.sf.moksha.persistence.jpa.GenericDaoJpa] [http-127.0.0.1-8080-1] [] makePersistent - using entity manager: org.jboss.seam.persistence.EntityManagerProxy@458e29
                                  2009-06-24 15:51:25,404 ERROR [javax.enterprise.resource.webcontainer.jsf.application] [http-127.0.0.1-8080-1] [] javax.ejb.EJBTransactionRolledbackException: EntityManager is closed
                                  javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: EntityManager is closed
                                       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
                                       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                                       at javax.faces.component.UICommand.broadcast(UICommand.java:387)
                                       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
                                       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:755)
                                       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                                       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                                       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                                       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                                       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                       at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                       at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                                       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                                       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                                       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                                       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                                       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                                       at java.lang.Thread.run(Thread.java:619)
                                  Caused by: javax.ejb.EJBTransactionRolledbackException: EntityManager is closed
                                       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                                       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                                       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                                       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
                                       at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
                                       at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
                                       at $Proxy99.makePersistent(Unknown Source)
                                       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:597)
                                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                                       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
                                       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                                       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                                       at org.javassist.tmp.java.lang.Object_$$_javassist_seam_6.makePersistent(Object_$$_javassist_seam_6.java)
                                       at net.sf.moksha.test.seam.test.impl.TestNewRefDataActionBean.createNewEgRefdata(TestNewRefDataActionBean.java:85)
                                       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:597)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                                       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                                       at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                                       at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                                       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                                       at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
                                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                       at java.lang.reflect.Method.invoke(Method.java:597)
                                       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                                       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                                       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                                       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
                                       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
                                       at $Proxy148.createNewEgRefdata(Unknown Source)
                                       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:597)
                                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                                       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
                                       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                                       at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:43)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                                       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                                       at org.javassist.tmp.java.lang.Object_$$_javassist_seam_5.createNewEgRefdata(Object_$$_javassist_seam_5.java)
                                       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:597)
                                       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                                       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                                       at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                                       at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                                       at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                                       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                                       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
                                       ... 42 more
                                  Caused by: java.lang.IllegalStateException: EntityManager is closed
                                       at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:42)
                                       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:227)
                                       at org.jboss.seam.persistence.EntityManagerProxy.merge(EntityManagerProxy.java:132)
                                       at net.sf.moksha.persistence.jpa.GenericDaoJpa.makePersistent(GenericDaoJpa.java:79)
                                       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:597)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                                       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                                       at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                                       at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30)
                                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                                       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                                       at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
                                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                       at java.lang.reflect.Method.invoke(Method.java:597)
                                       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                                       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                                       ... 146 more