首页 > 解决方案 > Tomcat 8.5.63 + Primefaces 4.0 + Atmosphere 2.1:响应代码 200 而不是 101

问题描述

将应用程序(Primefaces 4.0 + Atmosphere 2.1)从 Tomcat 7.0.108 迁移到版本 8.5.63 时遇到问题。

在部署在 tomcat 7 中的版本中,websockets 可以正常工作,但是在将应用程序迁移到 tomcat 8.5 时,websockets 无法正常工作,并显示以下内容

WebSocket connection to 'ws://127.0.0.1/eventos/primepush/campanyas/ini/52501/52594/52595/52596/1536/1536/fin/2C53B02B2088FA5DA639DA21532E6BA9?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.0.3-jquery&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 200


Websocket failed. Downgrading to Comet and resending

这是使用的配置

web.xml

<servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
    <init-param>
        <param-name>org.atmosphere.websocket.maxTextMessageSize</param-name>
        <param-value>0</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
        <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
    </init-param>
    <async-supported>true</async-supported>
</servlet>

pom.xml

  <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.3.1</version>
    </dependency>
    <dependency>
      <groupId>com.ning</groupId>
      <artifactId>async-http-client</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>org.atmosphere</groupId>
      <artifactId>atmosphere-runtime</artifactId>
      <!-- <version>2.0.4</version> -->
       <version>2.1.3</version>
    </dependency>

知道我可以在哪里解决这个问题吗?

标签: websockettomcat7tomcat8atmospherejava-websocket

解决方案


推荐阅读