1 Reply Latest reply on Sep 4, 2008 1:57 PM by Pete Muir

    Problems with Seam 2.1BETA1 migration - EntityManager is broken

    infinity2heaven Novice

      Background: I have a Seam 2.0.2CR1 EJB3 webapp on JBoss 4.2.2, Richfaces 3.2.1 in production. Its a fairly simple app with a few datatables, search screens, crud screens and security. Currently I'm developing for the next release and was curious to look into the 2.1beta version as I needed the excel module badly.


      Problems:
      Initially I wanted to use the seam-excel module independently on my working app (Seam 2.0.2CR1) but after configuring for sometime, I got a classNotFoundException for org.jboss.seam.document.DocumentStore.


      It looks like a class from Seam 2.1Beta. Talk about modularity.


      Hesitant at first, I started migrating to 2.1Beta1. I use JBoss's Maven 2 rep with EJB3 pom structures. I didn't have any problems earlier migrating to minor versions, as I simply update the seam-version property in the pom file and the app was fairly stable. However, this time -- things were different. The distribution had 7 more jars included in WEB-INF. I tinkered around to see who was putting these jars and figured something changed (again) in the transitive dependencies of seam modules. How can you just change the optional to mandatory dependencies from one version to another? Beats me. Anyways, I excluded them only to find another error:-


      java.lang.NoClassDefFoundError: org/jboss/el/lang/ExtendedFunctionMapper


      No idea. After a little search, I found I was not alone.


      Fine. So I took the latest el from the repo. Quite surprisingly, there are two version of it. One at  org.jboss.seam.jboss-el, which is what I was using till now and another one at org.jboss.el.jboss-el. This has the latest versions 2.0.2CR1. In fact, a lot of jboss jars are spilled all over in the repository , one has to really dig in more than one place to get the right one.


      Ofcourse, its not just changing in one place, thanks to the EJB 3's redundant packaging structure, I had to add/modify the exclusions in more than one place.


      So now, hopefully your earlier working app should work fine, isn't it?


      Results


      The webapp deploys fine. The pages show fine. But a lot of the functionality is broken. For most of the submits, I get the following error.


      java.lang.IllegalStateException: EntityManager is closed
           at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:66)
           at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:455)
           at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:450)
           at org.jboss.seam.persistence.EntityManagerProxy.joinTransaction(EntityManagerProxy.java:122)
           at org.jboss.seam.transaction.AbstractUserTransaction.enlist(AbstractUserTransaction.java:73)
           at org.jboss.seam.framework.EntityIdentifier.find(EntityIdentifier.java:31)
           at org.jboss.seam.framework.EntityIdentifier.find(EntityIdentifier.java:9)
           at org.jboss.seam.ui.AbstractEntityLoader.get(AbstractEntityLoader.java:30)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           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.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
           at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
           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.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at org.jboss.seam.ui.JpaEntityLoader_$$_javassist_4.get(JpaEntityLoader_$$_javassist_4.java)
           at org.jboss.seam.ui.EntityConverter.getAsObject(EntityConverter.java:80)
           at org.jboss.seam.ui.converter.PrioritizableConverter.getAsObject(PrioritizableConverter.java:61)
           at org.jboss.seam.ui.converter.ConverterChain.getAsObject(ConverterChain.java:107)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:152)
           at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectOneValue(MenuRenderer.java:197)
           at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:359)
           at javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
           at javax.faces.component.UIInput.validate(UIInput.java:860)
           at javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
           at javax.faces.component.UIInput.processValidators(UIInput.java:666)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
           at org.richfaces.component.UISwitchablePanel.processValidators(UISwitchablePanel.java:236)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
           at javax.faces.component.UIForm.processValidators(UIForm.java:229)
           at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:435)
           at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:235)
           at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:451)
           at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:73)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           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:179)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
           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:241)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Unknown Source)




      PLEASE NOTE -- My webapp is a perfectly working with the same code for 2.0.2CR1.


      Is there anything in Conversations, that has fundamentally changed?


      Is there any other way I can use the Excel module, in the interim?


      Pl suggest.

        • 1. Re: Problems with Seam 2.1BETA1 migration - EntityManager is broken
          Pete Muir Master

          Priya M wrote on Sep 04, 2008 01:32:


          Lots of whinging about expexted API changes





          The webapp deploys fine. The pages show fine. But a lot of the functionality is broken. For most of the submits, I get the following error.

          java.lang.IllegalStateException: EntityManager is closed
               at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:66)
               at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:455)
               at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:450)
               at org.jboss.seam.persistence.EntityManagerProxy.joinTransaction(EntityManagerProxy.java:122)
               at org.jboss.seam.transaction.AbstractUserTransaction.enlist(AbstractUserTransaction.java:73)
               at org.jboss.seam.framework.EntityIdentifier.find(EntityIdentifier.java:31)
               at org.jboss.seam.framework.EntityIdentifier.find(EntityIdentifier.java:9)
               at org.jboss.seam.ui.AbstractEntityLoader.get(AbstractEntityLoader.java:30)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               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.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
               at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
               at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
               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.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
               at org.jboss.seam.ui.JpaEntityLoader_$$_javassist_4.get(JpaEntityLoader_$$_javassist_4.java)
               at org.jboss.seam.ui.EntityConverter.getAsObject(EntityConverter.java:80)
               at org.jboss.seam.ui.converter.PrioritizableConverter.getAsObject(PrioritizableConverter.java:61)
               at org.jboss.seam.ui.converter.ConverterChain.getAsObject(ConverterChain.java:107)
               at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:152)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectOneValue(MenuRenderer.java:197)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:359)
               at javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
               at javax.faces.component.UIInput.validate(UIInput.java:860)
               at javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
               at javax.faces.component.UIInput.processValidators(UIInput.java:666)
               at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
               at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
               at org.richfaces.component.UISwitchablePanel.processValidators(UISwitchablePanel.java:236)
               at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
               at javax.faces.component.UIForm.processValidators(UIForm.java:229)
               at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:435)
               at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:235)
               at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:451)
               at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
               at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
               at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
               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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:73)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
               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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
               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:179)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
               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:241)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
               at java.lang.Thread.run(Unknown Source)





          It's a bug (which I'd expect with a beta) - and it's fixed in trunk.