PrimePush migration fails

UI Components for JSF
Post Reply
Tomsen
Posts: 2
Joined: 29 Apr 2014, 16:28

27 May 2014, 11:44

Hi everyone! I am currently trying to migrate from Primefaces 4.0 to 5.0 and my PrimePush is no longer working. I suspect it has something to do with my atmosphere setup, however, I have not been able to find anything on how it should be setup with PrimePush. I am basically trying to push messages to specific sessionIDs.

Here is my web.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
         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.5.xsd">
  <display-name>GUI</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>/pages/index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    <welcome-file>/axis2-web/index.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <display-name>Apache-Axis Servlet</display-name>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>*.jws</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>Apache-Axis Admin Servlet Web Admin</display-name>
    <servlet-name>AxisAdminServlet</servlet-name>
    <servlet-class>org.apache.axis2.transport.http.AxisAdminServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AxisAdminServlet</servlet-name>
    <url-pattern>/axis2-admin/*</url-pattern>
  </servlet-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>
	<servlet-name>Push Servlet</servlet-name>
	<servlet-class>org.primefaces.push.PushServlet</servlet-class>
  </servlet>
  <servlet>
                <description>AtmosphereServlet</description>
                <servlet-name>AtmosphereServlet</servlet-name>
                <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
                <load-on-startup>0</load-on-startup>
                <init-param>
		            <param-name>org.atmosphere.cpr.packages</param-name>
		            <param-value>de.dlr.gsoc.gssng</param-value>
		        </init-param>
        </servlet>
        <servlet-mapping>
                <servlet-name>AtmosphereServlet</servlet-name>
                <url-pattern>/atmosphere </url-pattern>
        </servlet-mapping> 
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
	<servlet-name>Push Servlet</servlet-name>
	<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
    <param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
    <param-value>/pages/*.xhtml</param-value>
  </context-param>
  
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
  <!-- CONFIGURATION FILES both Bean definition and security -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
                /WEB-INF/classes/config/spring/bean_def/beanDefinitions.xml
                /WEB-INF/classes/config/spring/security/securityConfig.xml
        </param-value>
    </context-param>
    <!-- CONFIGURATION FILES END HERE -->
    <!-- Integrate JSF and Spring -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    
    <listener>
                <listener-class>
                        org.springframework.web.context.request.RequestContextListener
                </listener-class>
        </listener>

    <listener>
        <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
    </listener>
    
    <!-- Integrate JSF and Spring End-->
    <!-- Enable Spring Filter, Spring Security works on the concept of Filters -->
    <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>
    <!-- Enable Spring Filter End -->
</web-app>
my SessionResource.java

Code: Select all

package de.dlr.gsoc.gssng;

import javax.faces.application.FacesMessage;

import org.atmosphere.config.service.AtmosphereHandlerService;
import org.primefaces.push.annotation.OnMessage;
import org.primefaces.push.annotation.PushEndpoint;
import org.primefaces.push.impl.JSONEncoder;

@PushEndpoint("/{sessionID}")
public class SessionResource {

	@OnMessage(encoders = {JSONEncoder.class})
	public FacesMessage onMessage(FacesMessage message)
	{
		System.out.println("SessionResource is running onMessage");
		return message;
	}
}
the Push/growl snippet from my xhtml file

Code: Select all

<p:socket onMessage="handleMessage" channel="/{sessionID}" />
    <p:growl widgetVar="growl" showDetail="true" />
and my actual push code from my webservice.jar

Code: Select all

eventBus.publish("/"+sessionID, new FacesMessage(currMessage.getClass().getSimpleName(), currMessage.getMessagePrivateAnnotation()));

no matter what I do I always get the error that there is no Braodcaster matching the path of the sessionID. Even when I try and use a static path as showed in the counter example it doesn't work. In addition I sometimes get the following error:

Code: Select all

No AtmosphereHandler found. Make sure you define it inside WEB-INF/atmosphere.xml or annotate using @___Service
however, this does not always happen.

The only way I receive no errors is when I push to all using the "/*" path. However those messages never get displayed in growl.

help would be greatly appreciated!

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

02 Jun 2014, 11:40

hmmm servlet 2.5 with primefaces 5.0 and atmosphere runtime 2.1.3 without async on your push servlet?

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
         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.5.xsd">
wow, okay, you are using push servlet and atmosphere servlet, together. why?

Code: Select all

  <servlet>
   <servlet-name>Push Servlet</servlet-name>
   <servlet-class>org.primefaces.push.PushServlet</servlet-class>
  </servlet>
  <servlet>
                <description>AtmosphereServlet</description>
                <servlet-name>AtmosphereServlet</servlet-name>
                <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
                <load-on-startup>0</load-on-startup>
                <init-param>
                  <param-name>org.atmosphere.cpr.packages</param-name>
                  <param-value>de.dlr.gsoc.gssng</param-value>
              </init-param>
        </servlet>
        <servlet-mapping>
                <servlet-name>AtmosphereServlet</servlet-name>
                <url-pattern>/atmosphere </url-pattern>
        </servlet-mapping> 
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
   <servlet-name>Push Servlet</servlet-name>
   <url-pattern>/primepush/*</url-pattern>
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

xvzolty
Posts: 1
Joined: 29 Apr 2015, 12:27

29 Apr 2015, 12:35

I've been getting errors trying to duplicate the simple Counter example from the showcase in my web app, which I'm deploying to Glassfish 4.0.???
raza

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests