5 Replies Latest reply on Aug 21, 2008 11:16 PM by Miloslav Vlach

    Expression error

    Miloslav Vlach Novice

      Hi,


      I have some function to check dynamically if display or not display the link. The function is implemented throught workflow and when I put in the xhtml page this expression:



      #{workflowProcessor.getWorkflow(t).hasAction(t, Workflow.ACTION_S_ACCEPT)}
      



      on the page appears true or false.



      When I put this expression to the <s:link ... rendered="     #{workflowProcessor.getWorkflow(t).hasAction(t, Workflow.ACTION_S_ACCEPT)}
      ">



      ...


      I get the exception:


      javax.faces.FacesException: javax.el.ELException: /listticket_tablecontrol.xhtml @12,49 value="#{ticketList.resultCount}": Error reading 'resultCount' on type cz.bpsolutions.servicedesk.actions.lists.TicketList_$$_javassist_3
           at javax.faces.component.UIParameter.getValue(UIParameter.java:170)
           at com.sun.faces.renderkit.html_basic.OutputMessageRenderer.encodeEnd(OutputMessageRenderer.java:110)
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
           at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
           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:109)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
           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.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
           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: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:182)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           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)
      Caused by: javax.el.ELException: /listticket_tablecontrol.xhtml @12,49 value="#{ticketList.resultCount}": Error reading 'resultCount' on type cz.bpsolutions.servicedesk.actions.lists.TicketList_$$_javassist_3
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
           at javax.faces.component.UIParameter.getValue(UIParameter.java:167)
           ... 50 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.getSingleResult(QueryImpl.java:99)
           at org.jboss.seam.framework.EntityQuery.initResultCount(EntityQuery.java:129)
           at org.jboss.seam.framework.EntityQuery.getResultCount(EntityQuery.java:120)
           at sun.reflect.GeneratedMethodAccessor497.invoke(Unknown Source)
           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.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
           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:41)
           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.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
           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 cz.bpsolutions.servicedesk.actions.lists.TicketList_$$_javassist_3.getResultCount(TicketList_$$_javassist_3.java)
           at sun.reflect.GeneratedMethodAccessor496.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           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:72)
           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)
           ... 51 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.getSingleResult(QueryImpl.java:80)
           ... 85 more
      Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a000017:cff0:48ab2df6:f4 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a000017:cff0:48ab2df6:f4 status: ActionStatus.ABORT_ONLY >)
           at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
           at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
           at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
           ... 99 more
      Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a000017:cff0:48ab2df6:f4 status: ActionStatus.ABORT_ONLY >
           at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:319)
           at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
           at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
           at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
           ... 101 more
      



      When I remove the rendered attribute from s:link all works fine. Know somebody what kind of error is thrown ?



      Thanks Mila

        • 1. Re: Expression error
          Guillaume Jeudy Master

          how does workflowProcessor name gets resolved? is it produced by a

          @Factory

          or an
          @Autocreate

          annotation ?


          Transaction is not active error usually hides the root exception. JSF and/or Seam is known to swallow exceptions sometimes.


          You can read this thread for my own experience with this: Transaction Is Not Active With Create Annotation


          In any case your best bet is to run in debug mode to find what is causing your transaction to be in ABORT ONLY state.


          I've been successfully tracking this down by putting a breakpoint in


          org.jboss.ejb3.tx.Ejb3TxPolicy



          that would require you to download jboss source code. If not you probably can set a breakpoint in some seam interceptor but I don't know how much success you will get there. I think some other people recommended

          org.jboss.seam.transaction.RollbackInterceptor

          as a good place to put your breakpoint..

          • 2. Re: Expression error
            Miloslav Vlach Novice

            Hi, thanks for your reply.


            At first, I am not using EJB3. I am using the Seam Pojo components. The workflowProcessor is the Seam component (POJO).


            The workflowProcessor is created (loaded) in listticket.xhtml - there is no @Factory, no @Autocreate.


            I hope I tell you what you ask me.


            Thanks Mila


            • 3. Re: Expression error
              Miloslav Vlach Novice

              Hi, you are right.


              The problem is there:


              a.xhtml code fragment


              <rich:dataTable value="..." var="t">
              #{workflowProcessor.getWorkflow(t).hasAction(t, Workflow.ACTION_S_REJECT)}
              </rich:dataTable>
              



              The a.xhtml works good.


              the b.xhtml fragment


              <rich:dataTable value="..." var="t">
                   <s:link view="/viewticket.xhtml" rendered="#{workflowProcessor.getWorkflow(t).hasAction(t, Workflow.ACTION_S_ACCEPT)}">
                        <h:graphicImage value="/img/reject.png"
                             title="#{messages['ticket.detail']}" />
                        <f:param name="ticketId" value="#{t.id}" />
                   </s:link>
              </rich:dataTable>
              



              The b.xhtml works not good - because the getWorkflow get NULL value of  the first argument (Ticket t)


              I don't know why ?


              Thanks Mila

              • 4. Re: Expression error
                Guillaume Jeudy Master

                Could this be some incompatibility between richfaces and seam tags ? if you put h:outputLink does your t value get propagated there ?

                • 5. Re: Expression error
                  Miloslav Vlach Novice

                  Hi,


                  using the h:outputLink doesn't solve my problem. The parameter is still null.


                  Is curious, that


                  #{workflowProcessor.getWorkflow(t).hasAction(t, Workflow.ACTION_S_REJECT)}
                  



                  work good and this works not good:


                  <h:outputText value="#{workflowProcessor.getWorkflow(t).hasAction(t, Workflow.ACTION_S_REJECT)}"></h:outputText>