1 Reply Latest reply on Mar 1, 2007 11:32 AM by Ludger Theile

    Problems with IntervalRenderer and PhaseListener

    Ludger Theile Newbie

      Hi,

      I tried to build a page with a clock.
      When I call the page, the clock is rendered, but after the first update after the renderer interval of 5 seconds I get a PhaseListener Exception:

      
      10:48:02,125 INFO [ClockBean] setRenderManager
      10:48:02,125 INFO [RenderHub] scheduled render service created:
       core pool size : 5
      10:48:02,140 INFO [ClockBean] getServerTime
      10:48:07,140 INFO [RenderHub] core render service created:
       core pool size : 10
       max pool size : 15
       keep alive time: 300000
      10:48:07,140 INFO [ClockBean] getState = com.icesoft.faces.webapp.xmlhttp.PersistentFacesState@14418746[com.icesoft.faces.context.BridgeFacesContext@531e15]
      10:48:07,140 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) beforePhase.
      java.lang.NullPointerException
       at org.jboss.seam.util.Parameters.convertMultiValueRequestParameter(Parameters.java:48)
       at org.jboss.seam.pdf.DocumentStorePhaseListener.beforePhase(DocumentStorePhaseListener.java:32)
       at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
       at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
       at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      10:48:07,140 INFO [ClockBean] renderingException fatal render failure for viewNumber 1
      
      


      Because i wondered why a method from org.jboss.seam.pdf.DocumentStorePhaseListener is called, I removed the jboss-seam-pdf.jar from clocktest.ear\clocktest.war\WEB-INF\lib. After this I get the following output:

      
      10:53:59,468 INFO [ClockBean] setRenderManager
      10:53:59,562 INFO [RenderHub] scheduled render service created:
       core pool size : 5
      10:53:59,625 INFO [ClockBean] getServerTime
      10:54:04,625 INFO [RenderHub] core render service created:
       core pool size : 10
       max pool size : 15
       keep alive time: 300000
      10:54:04,640 INFO [ClockBean] getState = com.icesoft.faces.webapp.xmlhttp.PersistentFacesState@26451219[com.icesoft.faces.context.BridgeFacesContext@1930e5b]
      10:54:04,640 ERROR [SeamPhaseListener] uncaught exception
      java.lang.IllegalStateException: No active application scope
       at org.jboss.seam.core.Init.instance(Init.java:78)
       at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsBeforePhase(TransactionalSeamPhaseListener.java:22)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:49)
       at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
       at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
       at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      10:54:04,640 ERROR [SeamPhaseListener] swallowing exception
      java.lang.IllegalStateException: No active application scope
       at org.jboss.seam.core.Init.instance(Init.java:78)
       at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsBeforePhase(TransactionalSeamPhaseListener.java:22)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:49)
       at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
       at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
       at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      10:54:04,640 ERROR [SeamPhaseListener] uncaught exception
      java.lang.IllegalStateException: No active application scope
       at org.jboss.seam.core.Init.instance(Init.java:78)
       at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsAfterPhase(TransactionalSeamPhaseListener.java:34)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:112)
       at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
       at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
       at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      10:54:04,640 ERROR [SeamPhaseListener] swallowing exception
      java.lang.IllegalStateException: No active application scope
       at org.jboss.seam.core.Init.instance(Init.java:78)
       at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsAfterPhase(TransactionalSeamPhaseListener.java:34)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:112)
       at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
       at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:180)
       at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:89)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      10:54:04,640 INFO [ClockBean] renderingException fatal render failure for viewNumber 1
      
      


      My environment: JBoss AS 4.0.5.GA, JBoss Seam 1.1.7.RC1, IceFaces 1.5.3

      Below my code:

      The ClockBean:

      
      import java.io.Serializable;
      import java.text.SimpleDateFormat;
      import java.util.Calendar;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.log.Log;
      
      import com.icesoft.faces.async.render.IntervalRenderer;
      import com.icesoft.faces.async.render.RenderManager;
      import com.icesoft.faces.async.render.Renderable;
      import com.icesoft.faces.webapp.xmlhttp.PersistentFacesState;
      import com.icesoft.faces.webapp.xmlhttp.RenderingException;
      
      @Name("clock")
      @Scope(ScopeType.SESSION)
      public class ClockBean implements Renderable, Serializable {
      
       private static final long serialVersionUID = -3056813303865921418L;
      
       @Logger
       private Log log;
      
       private final int renderInterval = 5000;
      
       private PersistentFacesState state;
      
       private IntervalRenderer clock;
      
       public void setRenderManager(RenderManager renderManager) {
       log.info("setRenderManager");
       clock = renderManager.getIntervalRenderer("clock");
       clock.setInterval(renderInterval);
       clock.add(this);
       clock.requestRender();
       }
      
       public RenderManager getRenderManager() {
       return null;
       }
      
       public PersistentFacesState getState() {
       if (null == state)
       state = PersistentFacesState.getInstance();
       if (null == state)
       log.info("getState = NULL");
       else
       log.info("getState = #0", state.toString());
       return state;
       }
      
       public void renderingException(RenderingException renderingException) {
       log.info("renderingException #0", renderingException.getMessage());
       if (clock != null) {
       clock.remove(this);
       clock = null;
       }
       }
      
       public String getServerTime() {
       log.info("getServerTime");
       SimpleDateFormat currentFormat = new SimpleDateFormat(
       "dd.MM.yyyy HH:mm");
       Calendar cal = currentFormat.getCalendar();
       cal.setTimeInMillis(System.currentTimeMillis());
       return currentFormat.format(cal.getTime());
       }
      
       public void setServerTime(String serverTime) {
      
       }
      }
      
      


      the home.xhtml:

      
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ice="http://www.icesoft.com/icefaces/component"
       xml:lang="de" lang="de">
      <head>
       <meta http-equiv="Content-Type"
       content="text/html; charset=iso-8859-1" />
       <title>Uhren test</title>
      
      </head>
      
      <body>
      <f:view>
       <div>
       <ice:outputText value="#{clock.serverTime}" />
       </div>
      </f:view>
      </body>
      
      </html>
      
      


      the 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:drools="http://jboss.com/products/seam/drools"
       xmlns:security="http://jboss.com/products/seam/security"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation=
       "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd
       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.1.xsd
       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.1.xsd
       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd">
      
       <core:init debug="true" jndi-pattern="@jndiPattern@"/>
      
       <core:manager concurrent-request-timeout="500"
       conversation-timeout="120000"
       conversation-id-parameter="cid"
       conversation-is-long-running-parameter="clr"/>
      
       <core:pages no-conversation-view-id="/home.xhtml"/>
      
       <core:managed-persistence-context name="entityManager"
       persistence-unit-jndi-name="java:/clocktestEntityManagerFactory"/>
      
       <core:ejb installed="@embeddedEjb@"/>
      
       <component name="renderManager"
       class="com.icesoft.faces.async.render.RenderManager"
       scope="APPLICATION" />
      
       <component name="clock" scope="SESSION">
       <property name="renderManager">#{renderManager}</property>
       </component>
      
      </components>
      
      


      the faces-config.xml:

      
      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE faces-config PUBLIC
       "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      
      <faces-config>
      
       <application>
       <message-bundle>messages</message-bundle>
       <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
       </application>
      
       <!-- Seam transaction management -->
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.TransactionalSeamPhaseListener</phase-listener>
       </lifecycle>
      
       <!-- No Seam transaction management -->
       <!--
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
       </lifecycle>
       -->
      
      </faces-config>
      
      


      the web.xml:

      
      <?xml version="1.0" ?>
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
       version="2.4">
      
       <context-param>
       <param-name>javax.faces.CONFIG_FILES</param-name>
       <param-value>/WEB-INF/navigation.xml</param-value>
       </context-param>
      
       <listener>
       <listener-class>
       org.jboss.seam.servlet.SeamListener
       </listener-class>
       </listener>
      
       <listener>
       <listener-class>
       org.apache.myfaces.webapp.StartupServletContextListener
       </listener-class>
       </listener>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
      
       <filter>
       <filter-name>Seam Exception Filter</filter-name>
       <filter-class>
       org.jboss.seam.servlet.SeamExceptionFilter
       </filter-class>
       </filter>
      
       <!--
       <filter>
       <filter-name>Seam Redirect Filter</filter-name>
       <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
       </filter>
       -->
      
       <filter-mapping>
       <filter-name>Seam Exception Filter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <!--
       <filter-mapping>
       <filter-name>Seam Redirect Filter</filter-name>
       <url-pattern>*.seam</url-pattern>
       </filter-mapping>
       -->
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!--
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
       -->
       <context-param>
       <param-name>com.icesoft.faces.actionURLSuffix</param-name>
       <param-value>.seam</param-value>
       </context-param>
      
       <context-param>
       <param-name>com.icesoft.faces.synchronousUpdate</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Blocking Servlet</servlet-name>
       <servlet-class>
       com.icesoft.faces.webapp.xmlhttp.BlockingServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet>
       <servlet-name>Persistent Faces Servlet</servlet-name>
       <servlet-class>
       com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet
       </servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Persistent Faces Servlet</servlet-name>
       <url-pattern>/xmlhttp/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>Persistent Faces Servlet</servlet-name>
       <url-pattern>/xmlhttp/*</url-pattern>
       </servlet-mapping>
      
       <servlet-mapping>
       <servlet-name>Persistent Faces Servlet</servlet-name>
       <url-pattern>*.iface</url-pattern>
       </servlet-mapping>
      
       <!-- Blocking Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Blocking Servlet</servlet-name>
       <url-pattern>/block/*</url-pattern>
       </servlet-mapping>
      
       <!-- Faces Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Persistent Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       </welcome-file-list>
      </web-app>
      
      



      Has someone an idea what's wrong?

      Thanks Ludger !