ERROR BlockingIOCometSupport:192 - Unable to resume suspende

UI Components for JSF
metinbaris
Posts: 6
Joined: 26 Dec 2013, 13:44

26 Dec 2013, 14:44

Hi to all,

I am using Primefaces 3.5 with Atmosphere 1.0.1, on Tomcat 7.

In web.xml, I have

Code: Select all

<context-param>
    <param-name>primefaces.PUSH_SERVER_URL</param-name>
    <param-value>http://localhost:8083</param-value>
  </context-param>
  <servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
  </servlet-mapping>
In my application, in every 2 minutes, there are ~50 pushes from the server. Pushes to clients are sometimes successfully, but sometimes I come accross the following error;

ERROR BlockingIOCometSupport:192 - Unable to resume suspended connection.

What can be the problem?

Thanks in advance,

Metin

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

26 Dec 2013, 21:27

metinbaris wrote:I am using Primefaces 3.5 with Atmosphere 1.0.1, on Tomcat 7.
1. It may be best to use at least Atmosphere 1.0.12 with PrimeFaces 3.5
2. what version of tomcat 7 are you using? tomcat 7.0.47 or an earlier/older release?
metinbaris wrote:In my application, in every 2 minutes, there are ~50 pushes from the server. Pushes to clients are sometimes successfully, but sometimes I come accross the following error;

ERROR BlockingIOCometSupport:192 - Unable to resume suspended connection.
are you using default BIO connector? you may want to use tomcat's NIO connector (see below).

Code: Select all

    <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" connectionTimeout="20000" acceptorThreadCount="2"
               redirectPort="8443" socket.directBuffer="false"/>
also, i recommend that you try atmosphere 2.0.3 or atmosphere 2.1.0-RC2 and PrimeFaces Elite 4.0.4 with the following web.xml:

Code: Select all

    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

metinbaris
Posts: 6
Joined: 26 Dec 2013, 13:44

30 Dec 2013, 17:55

I will try your suggestions and trace the progress.
Thank you very much.

Metin

metinbaris
Posts: 6
Joined: 26 Dec 2013, 13:44

05 May 2014, 18:15

I had put trace logs of Atmosphere framework in the application. The application was working successfuly for months, but suddenly websocket was closed and push is not working now. Below are the Atmosphere trace logs about the errors. I searched for the solution on internet with no success.

Code: Select all

TRACE#2014-May-02 17:27:39#WebSocket closed with 1002
TRACE#2014-May-02 17:27:39#WebSocket closed with 1002
TRACE#2014-May-02 17:27:39#WebSocket closed with 1002
DEBUG#2014-May-02 17:27:39#Timing out the connection for request 8930ae9b-8a30-4418-9334-7d9fe43c4b95
DEBUG#2014-May-02 17:27:39#Timing out the connection for request 465e6e33-b981-4196-a8e8-5796e54050fe
TRACE#2014-May-02 17:27:39#Method toString not supported
DEBUG#2014-May-02 17:27:39#Timing out the connection for request 8f330b7c-2a95-4719-a8a0-82f4e037887c
DEBUG#2014-May-02 17:27:39#Timing out the connection for request f820ec42-e69a-4afd-bc5d-c216e1055e98
TRACE#2014-May-02 17:27:39#Method toString not supported
TRACE#2014-May-02 17:27:39#Timeout request AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/kkcscounter requestURI=/myapp/primepush/kkcscounter destroyable=false} and response AtmosphereResponse{cookies=[], headers={Access-Control-Allow-Origin=http://myip/, Expires=-1, Access-Control-Allow-Credentials=true, X-Atmosphere-tracking-id=1e9deb80-10a1-46c6-a1a4-b83b4959c7aa, Pragma=no-cache, Cache-Control=no-store, no-cache, must-revalidate}, asyncIOWriter=org.apache.catalina.websocket.WsOutbound@174117f, status=200, statusMessage='OK', charSet='UTF-8', contentLength=-1, contentType='text/html', isCommited=false, locale=null, headerHandled=false, atmosphereRequest=AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/kkcscounter requestURI=/myapp/primepush/kkcscounter destroyable=false}, writeStatusAndHeader=false, delegateToNativeResponse=false, destroyable=false, response=null}
TRACE#2014-May-02 17:27:39#Timeout request AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/frequency requestURI=/myapp/primepush/frequency destroyable=false} and response AtmosphereResponse{cookies=[], headers={Access-Control-Allow-Origin=http://myip, Expires=-1, Access-Control-Allow-Credentials=true, X-Atmosphere-tracking-id=2b129a41-65a0-44e8-acba-8d7cdf2c1a9c, Pragma=no-cache, Cache-Control=no-store, no-cache, must-revalidate}, asyncIOWriter=org.apache.catalina.websocket.WsOutbound@27ca76, status=200, statusMessage='OK', charSet='UTF-8', contentLength=-1, contentType='text/html', isCommited=false, locale=null, headerHandled=false, atmosphereRequest=AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/frequency requestURI=/myapp/primepush/frequency destroyable=false}, writeStatusAndHeader=false, delegateToNativeResponse=false, destroyable=false, response=null}
TRACE#2014-May-02 17:27:39#Method toString not supported
DEBUG#2014-May-02 17:27:39#Timing out the connection for request e6f49024-372f-4b45-8943-923da22f6e73
TRACE#2014-May-02 17:27:39#Timeout request AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/gpscounter requestURI=/myapp/primepush/gpscounter destroyable=false} and response AtmosphereResponse{cookies=[], headers={Access-Control-Allow-Origin=http://myip/, Expires=-1, Access-Control-Allow-Credentials=true, X-Atmosphere-tracking-id=f1da103e-267d-4ddd-97c0-ae6166cccce7, Pragma=no-cache, Cache-Control=no-store, no-cache, must-revalidate}, asyncIOWriter=org.apache.catalina.websocket.WsOutbound@1511862, status=200, statusMessage='OK', charSet='UTF-8', contentLength=-1, contentType='text/html', isCommited=false, locale=null, headerHandled=false, atmosphereRequest=AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/gpscounter requestURI=/myapp/primepush/gpscounter destroyable=false}, writeStatusAndHeader=false, delegateToNativeResponse=false, destroyable=false, response=null}
TRACE#2014-May-02 17:27:39#Invoking listener with AtmosphereResourceEventImpl{isCancelled=false,
 isResumedOnTimeout=true,
 throwable=null,
 message=null,
	 resource=AtmosphereResourceImpl{
 uuid=8930ae9b-8a30-4418-9334-7d9fe43c4b95,
 transport=WEBSOCKET,
 action=Action{timeout=-1, type=TIMEOUT},
 isResumed=false,
 isCancelled=false,
 isSuspended=false,
 broadcaster=/frequency,
 isInScope=true,
 useWriter=true,
 listeners=[org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor$1@10cb2d4]}}
...
TRACE#2014-May-02 17:27:39#Cancelling 8930ae9b-8a30-4418-9334-7d9fe43c4b95
TRACE#2014-May-02 17:27:39#Unable to resume the suspended connection
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource 8930ae9b-8a30-4418-9334-7d9fe43c4b95
TRACE#2014-May-02 17:27:39#onEmpty /frequency
TRACE#2014-May-02 17:27:39#Cancelling 8f330b7c-2a95-4719-a8a0-82f4e037887c
TRACE#2014-May-02 17:27:39#Timeout request AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/counter requestURI=/myapp/primepush/counter destroyable=false} and response AtmosphereResponse{cookies=[], headers={Access-Control-Allow-Origin=http://myip/, Expires=-1, Access-Control-Allow-Credentials=true, X-Atmosphere-tracking-id=7fc088e3-c9cb-4fd0-a970-7154fa3fe7b5, Pragma=no-cache, Cache-Control=no-store, no-cache, must-revalidate}, asyncIOWriter=org.apache.catalina.websocket.WsOutbound@b88b9b, status=200, statusMessage='OK', charSet='UTF-8', contentLength=-1, contentType='text/html', isCommited=false, locale=null, headerHandled=false, atmosphereRequest=AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/counter requestURI=/myapp/primepush/counter destroyable=false}, writeStatusAndHeader=false, delegateToNativeResponse=false, destroyable=false, response=null}
TRACE#2014-May-02 17:27:39#Unable to resume the suspended connection
TRACE#2014-May-02 17:27:39#onEmpty /frequency
TRACE#2014-May-02 17:27:39#Cancelling 465e6e33-b981-4196-a8e8-5796e54050fe
TRACE#2014-May-02 17:27:39#Timeout request AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/kkcChannel requestURI=/myapp/primepush/kkcChannel destroyable=false} and response AtmosphereResponse{cookies=[], headers={Access-Control-Allow-Origin=http://myip/, Expires=-1, Access-Control-Allow-Credentials=true, X-Atmosphere-tracking-id=7ee059ea-c49e-4296-8d21-70b09a793b6b, Pragma=no-cache, Cache-Control=no-store, no-cache, must-revalidate}, asyncIOWriter=org.apache.catalina.websocket.WsOutbound@18d6972, status=200, statusMessage='OK', charSet='UTF-8', contentLength=-1, contentType='text/html', isCommited=false, locale=null, headerHandled=false, atmosphereRequest=AtmosphereRequest{ contextPath=/myapp servletPath=/primepush pathInfo=/kkcChannel requestURI=/myapp/primepush/kkcChannel destroyable=false}, writeStatusAndHeader=false, delegateToNativeResponse=false, destroyable=false, response=null}
TRACE#2014-May-02 17:27:39#Unable to resume the suspended connection
TRACE#2014-May-02 17:27:39#onEmpty /frequency
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource 8f330b7c-2a95-4719-a8a0-82f4e037887c
...
TRACE#2014-May-02 17:27:39#onEmpty /frequency
TRACE#2014-May-02 17:27:39#onEmpty /kkcscounter
TRACE#2014-May-02 17:27:39#Cancelling f820ec42-e69a-4afd-bc5d-c216e1055e98
TRACE#2014-May-02 17:27:39#onEmpty /kkcscounter
TRACE#2014-May-02 17:27:39#onEmpty /frequency
TRACE#2014-May-02 17:27:39#Cancelling e6f49024-372f-4b45-8943-923da22f6e73
TRACE#2014-May-02 17:27:39#onEmpty /frequency
TRACE#2014-May-02 17:27:39#onEmpty /kkcscounter
TRACE#2014-May-02 17:27:39#Unable to resume the suspended connection
TRACE#2014-May-02 17:27:39#onEmpty /kkcscounter
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource f820ec42-e69a-4afd-bc5d-c216e1055e98
TRACE#2014-May-02 17:27:39#onEmpty /kkcscounter
DEBUG#2014-May-02 17:27:39#Removing Broadcaster /frequency factory size now 5 
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource e6f49024-372f-4b45-8943-923da22f6e73
TRACE#2014-May-02 17:27:39#onEmpty /kkcscounter
TRACE#2014-May-02 17:27:39#onDestroy /frequency
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#onEmpty /counter
DEBUG#2014-May-02 17:27:39#Removing Broadcaster /kkcscounter factory size now 4 
TRACE#2014-May-02 17:27:39#onDestroy /frequency
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
TRACE#2014-May-02 17:27:39#Broadcaster /frequency is being destroyed and cannot be re-used. Policy was FIFO
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
TRACE#2014-May-02 17:27:39#Broadcaster /frequency is being destroyed and cannot be re-used. Resources are []
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource 8930ae9b-8a30-4418-9334-7d9fe43c4b95
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /frequency by invoking removeAtmosphereResource(AtmosphereResource r)
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /frequency by invoking removeAtmosphereResource(AtmosphereResource r)
TRACE#2014-May-02 17:27:39#onDestroy /kkcscounter
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#Broadcaster /kkcscounter is being destroyed and cannot be re-used. Policy was FIFO
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#Broadcaster /kkcscounter is being destroyed and cannot be re-used. Resources are []
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource 8f330b7c-2a95-4719-a8a0-82f4e037887c
TRACE#2014-May-02 17:27:39#onEmpty /counter
TRACE#2014-May-02 17:27:39#onEmpty /counter
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /kkcscounter by invoking removeAtmosphereResource(AtmosphereResource r)
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /kkcscounter by invoking removeAtmosphereResource(AtmosphereResource r)
DEBUG#2014-May-02 17:27:39#Removing Broadcaster /counter factory size now 3 
TRACE#2014-May-02 17:27:39#onDestroy /counter
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#onDestroy /counter
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#Broadcaster /counter is being destroyed and cannot be re-used. Policy was FIFO
TRACE#2014-May-02 17:27:39#onEmpty /kkcChannel
TRACE#2014-May-02 17:27:39#Broadcaster /counter is being destroyed and cannot be re-used. Resources are []
DEBUG#2014-May-02 17:27:39#Removing Broadcaster /kkcChannel factory size now 2 
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource f820ec42-e69a-4afd-bc5d-c216e1055e98
TRACE#2014-May-02 17:27:39#onDestroy /kkcChannel
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /counter by invoking removeAtmosphereResource(AtmosphereResource r)
TRACE#2014-May-02 17:27:39#onDestroy /kkcChannel
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /counter by invoking removeAtmosphereResource(AtmosphereResource r)
TRACE#2014-May-02 17:27:39#onDestroy /kkcChannel
TRACE#2014-May-02 17:27:39#Broadcaster /kkcChannel is being destroyed and cannot be re-used. Policy was FIFO
TRACE#2014-May-02 17:27:39#Broadcaster /kkcChannel is being destroyed and cannot be re-used. Resources are []
TRACE#2014-May-02 17:27:39#WebSocket.close() for AtmosphereResource e6f49024-372f-4b45-8943-923da22f6e73
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /kkcChannel by invoking removeAtmosphereResource(AtmosphereResource r)
DEBUG#2014-May-02 17:27:39#This Broadcaster has been destroyed and cannot be used /kkcChannel by invoking removeAtmosphereResource(AtmosphereResource r)
How can this error be solved?

Thanks in advance.

Metin

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

07 May 2014, 23:01

on Dec 30, 2013, you said,
metinbaris wrote:I will try your suggestions and trace the progress.
on May 5, 2014, you said,
metinbaris wrote:I had put trace logs of Atmosphere framework in the application. The application was working successfuly for months, but suddenly websocket was closed and push is not working now. Below are the Atmosphere trace logs about the errors. I searched for the solution on internet with no success.
reply with the following (after Dec 30, 2013)
* your PrimeFaces Push xhtml
* your java bean code
* your web.xml (entire web.xml)
* your dependencies (pom.xml), so we can see what version of PrimeFaces, Atmosphere, etc... that you are using

and then reply with what changed 'above' to possibly cause PrimeFaces Push to not work on May 5, 2014.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

metinbaris
Posts: 6
Joined: 26 Dec 2013, 13:44

08 May 2014, 13:28

I applied NIO Connector with the parameters you supplied, updated Primefaces to V3.5 and Atmosphere to V1.0.12 but I got the same push problem after months.
(I tried to update PF to V4 but I got many errors, so I moved back to PF V3.5)

As applying your suggestions, I put also trace logs for Atmosphere framework in December. I thought that the problem was solved because the push was working for a long period. But in May, push was suspended. So the same problem still exists. And I posted with Atmosphere logs.

The codes for push are below.

push.xhtml:

Code: Select all

<!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:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:metis="http://www.springframework.org/security/tags"
	xmlns:p="http://primefaces.org/ui">
	
<ui:composition template="/sayfa/layout/layout.xhtml">
	<ui:define name="content">
	<h:panelGrid columns="1" id="jPnl" style="width:100%;">
		<ui:include src="./monitorJoints.xhtml"></ui:include>		
		<p:socket onMessage="handleMessage" channel="/counter" >		
				<p:ajax onstart="disableBlock();" oncomplete="enableBlock();" update="frmR:feedbackGrid" />
				</p:socket>
				<p:socket onMessage="handleFrequency" channel="/frequency" />
				
				<p:socket onMessage="pushDevices" channel="/gpscounter" onstart="disableBlock();" oncomplete="enableBlock();" />
				
				<p:socket onMessage="handleKKCStatus" channel="/kkcscounter" onstart="disableBlock();" oncomplete="enableBlock();" />
		</h:panelGrid>
	</ui:define>
</ui:composition>
</html>
java code:

Code: Select all

//for frequency push
private void pushFrequency(String[] freq) {
		try
		{
			PushContext pushContext = PushContextFactory.getDefault().getPushContext();
			pushContext.push("/frequency", new Gson().toJson(freq));
		}
		catch (Throwable t) {
			logger.error("PushIncomingMessageBean.pushFrequency", t);
			t.printStackTrace();
			return;
		}
	}
//for counter push
private void pushJunctions(List<Group> directions, List<Group> allGroups) {
		try
		{

			List<String> directionIds = new ArrayList<String>();
			List<String> unDirectionIds = new ArrayList<String>();
			for (Group direction : directions) {
				directionIds.add("D" + direction.getId().toString());
			}

			Signal signal = new Signal();
			for (Group a : allGroups) {
				if (!directionIds.contains("D" + a.getId().toString()))
					unDirectionIds.add("D" + a.getId().toString());
			}
			signal.setUnDirectionIds(unDirectionIds);
			signal.setDirectionIds(directionIds);
			signal.setJid(centris.getId().toString());
			String signalJson = new Gson().toJson(signal);
			PushContext pushContext = PushContextFactory.getDefault()
					.getPushContext();
			pushContext.push("/counter", signalJson);
		}
		catch (Throwable t) {
			logger.error("PushIncomingMessageBean.pushJunctions", t);
			t.printStackTrace();
			return;
		}		
	}
//for kkcscounter push
public void executeStatusResult(String json) throws PushException{
		
		try
		{
			StatusBean statusJson = new Gson().fromJson(json,StatusBean.class);
			Centris centrisStatus = this.getCentrisMap().get(statusJson.getJunctionId());
			String statusicon = SequenceStates.getIconName(statusJson.getControllerStatus());
			centrisStatus.setKkcstatus(statusicon);
			centrisStatus.setConnected(true);
			activities.put(centrisStatus.getId(), new Date());
			statusJson.setStatusIcon(statusicon);
			String kkcStat = new Gson().toJson(statusJson);
			PushContext pushContext = PushContextFactory.getDefault()
					.getPushContext();
			pushContext.push("/kkcscounter", kkcStat);
		}
		catch (Throwable t) {
			logger.error("PushIncomingMessageBean.executeStatusResult", t);
			t.printStackTrace();
			return;
		}		
	}
web.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>metis</display-name>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
            classpath:applicationContext.xml
            /WEB-INF/applicationContext-security.xml
        </param-value>
  </context-param>
  <context-param>
   <param-name>facelets.DEVELOPMENT</param-name>
   <param-value>false</param-value>
</context-param>
  <context-param>
    <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>primefaces.PUSH_SERVER_URL</param-name>
    <param-value>http://localhost:8083</param-value>
  </context-param>
  <servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
  </servlet-mapping>
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
  </filter-mapping>
  <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>#{themeSwitcherBean.theme}</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Production</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
    <param-value>/junctionEdit.xhtml</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
    <param-value>false</param-value>
  </context-param>
  <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>*.xhtml</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
  </context-param>
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config>
  <error-page>
    <error-code>404</error-code>
    <location>/sayfa/error/404.xhtml</location>
  </error-page>
  <error-page>
    <error-code>500</error-code>
    <location>/sayfa/error/500.xhtml</location>
  </error-page>
  <error-page>  
       <exception-type>java.lang.Exception</exception-type>  
       <location>/sayfa/error/error.xhtml</location>  
</error-page>
</web-app>
pom.xml:

Code: Select all

<dependencies>
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>3.5</version>
		</dependency>
		<dependency>
			<groupId>org.atmosphere</groupId>
			<artifactId>atmosphere-runtime</artifactId>
			<version>1.0.12</version>
		</dependency>
		<dependency>
			<groupId>com.ibm.icu</groupId>
			<artifactId>icu4j</artifactId>
			<version>3.8</version>
		</dependency>
		
		<dependency>  
    		<groupId>org.primefaces.themes</groupId>  
    		<artifactId>all-themes</artifactId>  
    		<version>1.0.9</version>  
		</dependency>
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.1.7</version>
		</dependency>
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.1.7</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.2</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>javax.el</groupId>
			<artifactId>el-api</artifactId>
			<version>2.2</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>javax.validation</groupId>
			<artifactId>validation-api</artifactId>
			<version>1.0.0.GA</version>
		</dependency>

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

17 May 2014, 23:23

the following (multiple p:socket's) is not/never recommended. you 'really' should avoid multiple p:socket's on one page, have one channel, and in your handleMessage, read the messages pushed from the server, and update your page, accordingly, per message pushed from server. Look at PrimeFaces Push showcase - Chat app, and look for the p:remoteCommand, etc...

Code: Select all

      <p:socket onMessage="handleMessage" channel="/counter" >      
            <p:ajax onstart="disableBlock();" oncomplete="enableBlock();" update="frmR:feedbackGrid" />
            </p:socket>
            <p:socket onMessage="handleFrequency" channel="/frequency" />
            
            <p:socket onMessage="pushDevices" channel="/gpscounter" onstart="disableBlock();" oncomplete="enableBlock();" />
            
            <p:socket onMessage="handleKKCStatus" channel="/kkcscounter" onstart="disableBlock();" oncomplete="enableBlock();" />
what browser and tomcat version worked well together between December and May?

atmosphere 1.0.12 and primefaces 3.5 is quite old. would be nice if you can migrate your app to primefaces 5.0 and use atmosphere 2.1.3 (but remember primefaces push is changed in primefaces 5.0, pushcontext is deprecated,and you have to use eventbus, etc...).

if/when you migrate to primefaces 5.0 and use atmosphere 2.1.3, my recommendation is to change the following:

Code: Select all

  <servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
  </servlet-mapping>
to this below,

Code: Select all

    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>
where you will need this (for servlet 3.0 web.xml and atmosphere 2.1.3)

Code: Select all

        <async-supported>true</async-supported>
and Jeanfrancois recommends this

Code: Select all

        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

metinbaris
Posts: 6
Joined: 26 Dec 2013, 13:44

12 Feb 2015, 16:00

Hello Howard,

We've migrated to PF 5.0 and Atmosphere 2.1.3, we've also made changes you suggested. However the problem still exists. Everything works for a while(approximately 1 week long), then push stops working. The following error occurs continuously on server side and the application cannot properly work. This forces me to shutdown the server:

Code: Select all

Feb 05, 2015 11:41:36 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Push Servlet] in context with path [/metis] threw exception
java.lang.IllegalStateException: Not supported.
	at org.apache.catalina.connector.Request.startAsync(Request.java:1658)
	at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1029)
	at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
	at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
	at org.atmosphere.cpr.AtmosphereRequest.startAsync(AtmosphereRequest.java:692)
	at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:93)
	at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:68)
	at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.doService(Tomcat7Servlet30SupportWithWebSocket.java:67)
	at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:98)
	at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.service(Tomcat7Servlet30SupportWithWebSocket.java:62)
	at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1805)
	at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:205)
	at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:191)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)


I've also put new PF component <p:ajaxExceptionHandler on UI view to see the error on client side. The following error also occurs continuously on browser:

Code: Select all

Feb 05, 2015 11:47:00 AM org.primefaces.application.exceptionhandler.PrimeExceptionHandler handle
SEVERE: Cannot forward after response has been committed
java.lang.IllegalStateException: Cannot forward after response has been committed
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:348)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546)
	at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)
	at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:604)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:543)
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:460)
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:411)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Push configuration in web xml is:

Code: Select all

         <context-param>
		<param-name>primefaces.PUSH_SERVER_URL</param-name>
		<param-value>${pushUrl}</param-value>
	</context-param>
	<servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </servlet>

	<servlet-mapping>
		<servlet-name>Push Servlet</servlet-name>
		<url-pattern>/primepush/*</url-pattern>
	</servlet-mapping>
Since async support is enabled, I do not understand why it throws not supported exceptions after working for a period of time.

Thanks in advance.

Metin

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

12 Feb 2015, 19:46

what happens when you migrate to PrimeFaces 5.1 and Atmosphere 2.2.5?
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

metinbaris
Posts: 6
Joined: 26 Dec 2013, 13:44

14 Feb 2015, 18:40

I think this issue is not about the version, since I tried PF 3.5, PF 4 and PF 5 for a long time. We used all of these PF versions in our project for more then 1 year and the same problem occured with all versions: Push works for a period of time, and then it stops after throwing "java.lang.IllegalStateException: Not supported" exceptions.

I also tried to upgrade PF to 5.1, but our charts didn't work after migration. Since I can't deploy in production right now, I can't reproduce the error.
Is there a limitation on push thread counts or any other configuration?

Thanks in advance.

Metin

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests