5 Replies Latest reply on Apr 30, 2008 6:12 PM by Andy Gibson

    EntityQuery.resultList doesn't work

    infinity2heaven Novice

      <framework:entity-query name="fooQuery" ejbql="select f from Foo f" />



      The same code works in one facelets page and not in the other, I get this error


      value="#{fooQuery.resultList}": Error reading 'resultList' on type org.jboss.seam.framework.EntityQuery_$$_javassist_1  




      Again -- the same fragment of code works in one facelets page and not in another. I can post any other code, if needed.

        • 1. Re: EntityQuery.resultList doesn't work
          infinity2heaven Novice

          The Full Stack Trace



          javax.faces.FacesException: javax.el.ELException: /funds.xhtml.xhtml @49,130 value="#{fooQuery.resultList}": Error reading 'resultList' on type org.jboss.seam.framework.EntityQuery_$$_javassist_2
               at javax.faces.component.UISelectItems.getValue(UISelectItems.java:133)
               at org.jboss.seam.ui.component.UISelectItems.getValue(UISelectItems.java:156)
               at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:323)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:675)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:793)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:335)
               at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
               at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
               at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
               at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
               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:45)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
               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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
               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)
          Caused by: javax.el.ELException: /funds.xhtml.xhtml @49,130 value="#{fooQuery.resultList}": Error reading 'resultList' on type org.jboss.seam.framework.EntityQuery_$$_javassist_2
               at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
               at javax.faces.component.UISelectItems.getValue(UISelectItems.java:130)
               ... 54 more
          Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
               at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
               at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
               at org.jboss.seam.framework.EntityQuery.initResultList(EntityQuery.java:74)
               at org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:65)
               at sun.reflect.GeneratedMethodAccessor196.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: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.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: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.framework.EntityQuery_$$_javassist_2.getResultList(EntityQuery_$$_javassist_2.java)
               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 javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
               at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
               at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
               at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
               at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
               at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
               at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
               ... 55 more
          Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
               at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
               at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
               at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
               at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
               at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
               at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
               at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
               at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
               at org.hibernate.loader.Loader.doQuery(Loader.java:673)
               at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
               at org.hibernate.loader.Loader.doList(Loader.java:2220)
               at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
               at org.hibernate.loader.Loader.list(Loader.java:2099)
               at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
               at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
               at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
               at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
               at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
               at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
               ... 86 more
          Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53eef8d6:8a6:48177ebd:190 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53eef8d6:8a6:48177ebd:190 status: ActionStatus.ABORT_ONLY >)
               at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
               at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
               at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
               ... 100 more
          Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -53eef8d6:8a6:48177ebd:190 status: ActionStatus.ABORT_ONLY >
               at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:304)
               at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
               at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
               at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)



          What is frustrating is, it works on one facelet and doesn't on the other while everything else remains the same.

          • 2. Re: EntityQuery.resultList doesn't work
            Vemula sriramsudheer Newbie

            I too am getting same Problem! Does any one know this please help us

            • 3. Re: EntityQuery.resultList doesn't work
              Carsten Hoehne Master

              Thats an error we have seen many times,too.
              What we have done to solve it is simple as



              • compare the working and non working facelets pages.

              • Find the differences



              After that we experinece a little with the code and we have detected that our originally approach was faulty:-(
              IMHO, the exception is both correct, because there is really no transaction, and not correct, because the exception doies not help to solve the problem.


              • 4. Re: EntityQuery.resultList doesn't work
                infinity2heaven Novice

                Seam does a great job of eating of all the exceptions and displaying a dubious, wrapped exception on top. As you said, there is no clue what is going on, unless you are a Seam Framework Developer yourself. I did a search on the Transaction exception and it appears to be more complicated than I imagined


                Anybody else, have a better suggestion, pl do share

                • 5. Re: EntityQuery.resultList doesn't work
                  Andy Gibson Novice

                  In the one that doesn't work, remove the reference to the foo.resultList and add the following :


                  
                  <h:outputText value="Transaction State : #{transaction.active}"/>
                  
                  



                  You are probably using Seam transactions, check in components.xml, in the core:init attribute, does it include the following :


                  transaction-management-enabled="false"
                  



                  If not, then it defaults to true and Seam is managing your transactions.


                  Cheers,


                  Andy Gibson