0

I'm running Glassfish 4, EclipseLink 2.5 with primefaces 5.3. When I post an event to the primefaces event bus and attempt to update my datagrid component it will update in the submitting browser, but in a seperate session (second user) the update fails and I see the following error in the browser console:

WebSocket connection to 'ws://localhost:8080/myapp/primepush/notify?X-
Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.12-javascript&   
X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&
X-atmo-protocol=true' failed: Error during WebSocket handshake: 
Unexpected response code: 200
push.js.xhtml?ln=primefaces&v=5.3:1 Websocket closed, reason: 
Connection   was closed abnormally 
(that is, with no close frame being   sent). - wasClean: false

I also see this exception thrown on the server:

Warning: StandardWrapperValve[Push Servlet]: 
Servlet.service() for  servlet Push Servlet threw exception
java.io.IOException: 
java.util.concurrent.TimeoutException

I'm firing the event by doing this:

EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/notify", "price");

EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/notify", "order");

I then handle these in javascript and update via remotecommand:

<script type="text/javascript">
            function handleMessage(data) 
            {
                console.log("handle message fired")
                console.log(data);
                if(data == 'order')
                {
                    console.log("data is order");
                    checkOrders();
                }

                if(data == 'price')
                {
                    console.log("data is price");
                    updateWidget();
                    updateBalance();
                }
            } 
    </script>

<p:remoteCommand name="updateWidget"
             actionListener="#{parliamentManager.findLatestPrices}"
             update="prices"
             autoRun="true"/>

<p:remoteCommand name="updateBalance"
             actionListener="#{parliamentManager.findTraders}"
             update="balance"
             autoRun="true"/>

<p:remoteCommand name="checkOrders"
             actionListener="#{parliamentManager.checkOrders}" /> 
</h:form>
<p:socket onMessage="handleMessage" channel="/notify" />

This is my datagrid component:

<h:panelGroup id="resultDisplay">                          
            <p:dataGrid id="prices" var="orderBooks" value=
            "#{parliamentManager.latestPricesResults}" columns="3" rows="12">
                <p:column>
                <p:panel header="#{orderBooks.bidOrderId.member.memberId}">
            <h:panelGrid columns="1">
            <h:outputText value="#{orderBooks.price}" />
            </h:panelGrid>
            </p:panel>
            </p:column>
        </p:dataGrid>

To return to my opening paragraph, why does my update to the datagrid component succeed in the submitting browser, but in the other example the update fails and I see the error message?

zobbo
  • 117
  • 2
  • 13

1 Answers1

0

I resolved this by updating my version of Glassfish to 4.1.1 (build 1), the original build was quite old (2014).

zobbo
  • 117
  • 2
  • 13
  • 1
    So please tag the question above with glassfish, provide info to WHICH version you **upgraded** (should we guess?) – Kukeltje Mar 05 '16 at 16:37