I am developing an application with Primefaces that uses the pub / sub model provided by this framework.
Technology stack:
- tomcat 8
- java 8
- primefaces 6
- atmosphere-runtime 2.4.7
In the web.xml file, I define the servlet for Push:
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
When I try to get an instance of Eventbus
to launch a notification, EventBusFactory
returns null
:
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish(notificacion.getRuta(), notificacion);
I have investigated the primefaces forums where they indicate that the problem should be solved by entering the <load-on-startup>1</load-on-startup>
parameter of web.xml , however it is not my case.