Sam Sam - 29 days ago 16
Java Question

Websocket issue on wildfly cluster

I am using richfaces a4j:push in my Spring-JSF integrated application. I am able to push messages to the browser using websocket in my non cluster environment on wildfly 8.0.0.
When I deploy the application on wildfly8.0.0 on redhat enterprise 7.0 with httpd clustering the push messages are not working.

I get the following error on cluster environment:

17:15:22,862 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /star/__richfaces_push: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade.


My cluster is configured with mod_cluster, referring the document

When I look for details on error UT000077, it says ‘Apache httpd doesn't support HTTP upgrade out of box’ I understand HTTP upgrade is required for websocket communication. It is suggested to use mod_proxy_wstunnel. However the details are not available for this configuration.

Any pointers/suggestions are much appreciated.

Sam Sam
Answer

At the time of this answer AJP [which is the default one] does not support HTTP upgrade and hence not websocket.

If you switch to HTTP websocket will work.

Following changes you need to do to switch to AJP

Change

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so

To

#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

[comment out proxy_ajp_module and added proxy_http_module]

In modcluster sub-system

Change

<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>

To

<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="default">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>

[“default” is the name of the http listener]

Also you need to load mod_proxy_wstunnel in your httpd

Comments