Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4429

websockets not working on Glassfish (5)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 9.0.0, 8.6.3
    • Fix Version/s: 9.0.1, 8.6.4
    • Component/s: ZK Client Engine
    • Security Level: Jimmy
    • Labels:
      None
    • Environment:

      works with Jetty 9.4 / Tomcat

      fails on Glassfish 5

      not tested on Wildfly/WAS

      Description

      Steps to Reproduce

      enable websockets in zk.xml

      trigger an AU

      <zk>
          <button onClick="Clients.log(event.toString())" label="test event"/>
      </zk>
      

      Current Result

      server error in Glassfish 5

      [2019-11-27T12:47:04.894+0800] [glassfish 5.0] [WARNING] [] [org.glassfish.tyrus.core.TyrusEndpointWrapper] [tid: _ThreadID=85 _ThreadName=http-listener-1(3)] [timeMillis: 1574830024894] [levelValue: 900] [[
        < Session c9e4719f-456e-4261-9890-064d574d2dfc [1 ms]: ZK Session cannot be null!
      java.lang.IllegalStateException: ZK Session cannot be null!
      	at org.zkoss.zk.ui.http.ZKWebSocket.getDesktop(ZKWebSocket.java:65)
      	at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.onOpen(WebSocketEndPoint.java:93)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.glassfish.tyrus.core.TyrusEndpointWrapper.onConnect(TyrusEndpointWrapper.java:777)
      	at org.glassfish.tyrus.core.TyrusWebSocket.onConnect(TyrusWebSocket.java:159)
      	at org.glassfish.tyrus.core.TyrusWebSocketEngine$TyrusConnection.<init>(TyrusWebSocketEngine.java:821)
      	at org.glassfish.tyrus.core.TyrusWebSocketEngine$SuccessfulUpgradeInfo.createConnection(TyrusWebSocketEngine.java:757)
      	at org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler.init(TyrusHttpUpgradeHandler.java:110)
      	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:695)
      	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
      	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
      	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
      	at java.lang.Thread.run(Thread.java:748)
      

      Client engine doesn't react anymore

      Expected Result

      working WS connection
      graceful fallback to AJAX

      Debug Information

      the ZK session stored here:

      is not available during onOpen:

      Workaround

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cor3000 cor3000
                Reporter:
                cor3000 cor3000
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: