Push doesn't works with Glassfish in cluster mode

UI Components for JSF
Post Reply
davidmet
Posts: 6
Joined: 23 Apr 2014, 14:42

23 Apr 2014, 15:11

Hi.

I developed a webapp and I implemented a Push service that updates a specific value. This works fine in my development machine with NetBeans 7.4 and Glassfish 4.0.

The issue is when I publish the webapp in a server with Glassfish configured in cluster mode. This doesn't works and no error messages in server log when I execute the update value.

Atmosphere 2.1.3
Primefaces community edition 4.0
Glassfish 4.0
Apache 2.2 (loadbalancer)

I have found info about enable Comet in http-listener-1 protocol but doesn't works either.

web.xml

Code: Select all

<servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <init-param>
            <param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
            <param-value>org.atmosphere.client.TrackMessageSizeInterceptor</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
            <param-value>org.atmosphere.cache.SessionBroadcasterCache</param-value>
        </init-param>
        <!--<init-param>  
            <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>  
            <param-value>org.atmosphere.cache.HeaderBroadcasterCache</param-value>  
        </init-param> -->
        <init-param>
            <param-name>org.atmosphere.cpr.broadcasterClass</param-name>
            <param-value>org.atmosphere.cpr.DefaultBroadcaster</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.cpr.sessionSupport</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.disableOnStateEvent</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.useWebSocket</param-name>
            <param-value>false</param-value> <!--  WITH TRUE VALUE DOESN'T WORKS EITHER -->
        </init-param>
        <init-param>  
            <param-name>org.atmosphere.useNative</param-name>  
            <param-value>true</param-value>  
        </init-param>
        <init-param>  
            <param-name>org.atmosphere.resumeOnBroadcast</param-name>  
            <param-value>true</param-value>  
        </init-param>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>
Thanks in advance for the help.
Greetings.
Primefaces 5.0
Glassfish 4.0 (JSF 2.2)
Java 1.7

jfarcand
Posts: 19
Joined: 02 Feb 2010, 20:23

23 Apr 2014, 23:44

You need to post more information :-) Anything in the log? If you want to share messages between node, you will need to use one of the Atmosphere Cloud Solution. But first, give us some meat to look at :-)

davidmet
Posts: 6
Joined: 23 Apr 2014, 14:42

25 Apr 2014, 14:16

jfarcand wrote:You need to post more information :-) Anything in the log? If you want to share messages between node, you will need to use one of the Atmosphere Cloud Solution. But first, give us some meat to look at :-)
Hi... :D

Well... in the server log, and any of its instances, doesn't show errors and warnings when I execute the Push:

Code: Select all

PushContext pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/interes", obj.getInteres());
And the listener is:

Code: Select all

<p:socket onMessage="modificaInteres" channel="/interes" />
<script type="text/javascript">
            function modificaInteres(data) {
                actualizaInteresCuentaAlumno([{name: 'interesCuentaAlumno', value: data}]);
            }
</script>
In a standalone instance (simple domain1 configuration) this works fine and without problems, but, in the cluster doesn't works. Therefore, I imagine the code is correct, however no the server configuration, or just the architecture is not adequate to this code.

Standalone: Glassfish Http listener ----> Webapp
Cluster: Apache Http listener (loadbalancer) ----(jk_mod)----> Glassfish JK module ----> Webapp

I hope this is helpful.
Greetings.
Primefaces 5.0
Glassfish 4.0 (JSF 2.2)
Java 1.7

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

25 Apr 2014, 18:27

websockets does not work with mod_jk afaik... but afaik there is a special module for apache so websockets can be 'proxied' ... ws_mod or something

jfarcand
Posts: 19
Joined: 02 Feb 2010, 20:23

01 May 2014, 19:31

true. And also you need to use Atmosphere Cloud extension if you want to distribute messages across the cluster :-)

davidmet
Posts: 6
Joined: 23 Apr 2014, 14:42

15 May 2014, 15:34

jfarcand wrote:true. And also you need to use Atmosphere Cloud extension if you want to distribute messages across the cluster :-)
kukeltje wrote:websockets does not work with mod_jk afaik... but afaik there is a special module for apache so websockets can be 'proxied' ... ws_mod or something
Thanks for the explanation. Sorry about the delay, I was a little busy these days.
I will check this solution. For now, I solved the trouble using local querys in the session.

Thanks a lot.

Edit:
Now I upgraded to Primefaces 5.0.
Primefaces 5.0
Glassfish 4.0 (JSF 2.2)
Java 1.7

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 14 guests