5 Replies Latest reply on Jan 4, 2008 6:48 AM by Pete Muir

    Home and Query objects broken after migration to Seam 2.0.0.

    Kindor Bazul Newbie

      All my existing classes that extend EntityQuery and EntityHome are throwing "EntityManager is null". The EM is correctly injected into the session beans. Any idea what the problem can be ?

      ERROR [STDERR] Jan 4, 2008 7:37:08 AM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/account.xhtml]
      java.lang.IllegalStateException: entityManager is null
       at org.jboss.seam.framework.EntityHome.create(EntityHome.java:26)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
       at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
       at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
       at com.myproject.core.model.ContactHome_$$_javassist_7.create(ContactHome_$$_javassist_7.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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
       at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
       at org.jboss.seam.Component.newInstance(Component.java:1968)
       at org.jboss.seam.Component.getInstance(Component.java:1865)
       at org.jboss.seam.Component.getInstance(Component.java:1832)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
       at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
       at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
       at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
       at org.jboss.seam.navigation.Param.getStringValueFromModel(Param.java:132)
       at org.jboss.seam.navigation.Pages.getStringValuesFromModel(Pages.java:688)
       at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:51)
       at org.jboss.seam.ui.renderkit.LinkRendererBase.doEncodeBegin(LinkRendererBase.java:26)
       at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79)
       at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       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:68)
       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:44)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       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.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:595)
      


        • 2. Re: Home and Query objects broken after migration to Seam 2.
          Kindor Bazul Newbie

          components.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <components xmlns="http://jboss.com/products/seam/components"
           xmlns:core="http://jboss.com/products/seam/core"
           xmlns:security="http://jboss.com/products/seam/security"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:mail="http://jboss.com/products/seam/mail"
           xmlns:transaction="http://jboss.com/products/seam/transaction"
           xmlns:jms="http://www.jboss.org/soa/endpoint/protocol/jms"
           xsi:schemaLocation=
           "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
           http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
           http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-1.2.xsd
           http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
          
           <core:init debug="true" jndi-pattern="@jndiPattern@"/>
           <core:managed-persistence-context name="entityManager"
           persistence-unit-jndi-name="java:/myEntityManagerFactory"/>
           <core:manager conversation-timeout="120000"
           concurrent-request-timeout="500"
           conversation-id-parameter="cid"/>
           <transaction:ejb-transaction/>
           <core:dispatcher />
           <security:identity authenticate-method="#{authenticator.authenticate}"/>
           </components>
          


          persistence.xml
          <?xml version="1.0" encoding="UTF-8"?>
          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
           version="1.0">
          
           <persistence-unit name="myProject">
           <provider>org.hibernate.ejb.HibernatePersistence</provider>
           <jta-data-source>java:/myProjectDatasource</jta-data-source>
           <properties>
           <property name="hibernate.cache.use_query_cache" value="true"/>
           <property name="hibernate.show_sql" value="true"/>
           <property name="jboss.entity.manager.factory.jndi.name" value="java:/myProjectEntityManagerFactory"/>
           <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
           </properties>
           </persistence-unit>
          </persistence>
          


          • 3. Re: Home and Query objects broken after migration to Seam 2.
            Pete Muir Master

            You need to update your components.xml to Seam2 schemas, see the seam2migraton guide

            • 4. Re: Home and Query objects broken after migration to Seam 2.
              Kindor Bazul Newbie

              Good remark, but it doesn't suffice to change the schemas. I also changed <core:managed-persistence-context/> to <persistence:managed-persistence-context/> which I think is not documented in the migration guide.

              Now my problem with the Query and Home is solved but there might be other things around to update (namespaces like jms...) ?

              • 5. Re: Home and Query objects broken after migration to Seam 2.
                Pete Muir Master

                It does

                * Persistence-related components moved to org.jboss.seam.persistence
                ...
                The new packaging comes with new namespaces and new schemas for
                components.xml. The namespace for components in package

                org.jboss.seam.foobar

                Is now:

                http://jboss.com/products/seam/foobar

                And the schema is:

                http://jboss.com/products/seam/foobar-2.0.xsd