2016-01-31 79 views
0

我正在运行Glassfish 4,带有primefaces 5.3的EclipseLink 2.5。当我将事件发布到primefaces事件总线并尝试更新我的datagrid组件时,它将在提交浏览器中更新,但在单独的会话中(第二个用户)更新失败,我在浏览器控制台中看到以下错误:p:套接字在WebSocket握手期间出现错误:意外的响应代码:200

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 

我也看到这个异常抛出的服务器上:

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

我做这个触发事件:

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

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

然后我处理这些在JA vascript并通过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" /> 

这是我的DataGrid组件:

<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> 

要回到我的首段,为什么我更新到DataGrid组件在提交浏览器成功,但在另一个示例中更新失败,我看到错误消息?

回答

0

我解决了这个问题,通过将我的Glassfish版本更新到4.1.1(版本1),原始版本比较旧(2014)。

+1

所以请用玻璃鱼标记上面的问题,提供信息给你升级的哪个版本**(我们应该猜测?) – Kukeltje

相关问题