Skip to main content

Websocket connection not establishing in glasshfish server. How to fix it?

No replies
abhijitaitwade
Offline
Joined: 2012-02-18
Points: 0

Hi i am trying glassfish server(3.1.1) websocket chatting example with grizzly(1.9.36) framework.
I have enabled the web socket support to glassfish with this executing this command
" asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.websockets-support-enabled=true "
I used this code http://antwerkz.com/glassfish-web-sockets-sample/?replytocom=105#respond site for imlement websocket example with glassfish and grizzly.
now issue is that my websocket connection is not eastablish with glassfish server.
My browser has enabled the web socket support. Mozilla browser gives this error
" Firefox can't establish a connection to the server at ws://localhost:8081/nomavenws/chat. var connection = new WebSocket('ws://localhost:8081/nomavenws/chat'); "
and sometimes i getgalssfih server side this error
" SEVERE: Null keys are not allowed. com.sun.grizzly.websockets.HandshakeException: Null keys are not allowed. at com.sun.grizzly.websockets.SecKey.(SecKey.java:79) at com.sun.grizzly.websockets.ServerHandShake.(ServerHandShake.java:68) at com.sun.grizzly.websockets.ServerNetworkHandler.handshake(ServerNetworkHandler.java:95) at com.sun.grizzly.websockets.WebSocketEngine.upgrade(WebSocketEngine.java:136) at com.sun.grizzly.websockets.WebSocketAsyncFilter.doFilter(WebSocketAsyncFilter.java:52) at com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:171) at com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:143) at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:94) at com.sun.grizzly.http.TaskBase.run(TaskBase.java:193) at com.sun.grizzly.http.TaskBase.execute(TaskBase.java:175) at com.sun.grizzly.arp.DefaultAsyncHandler.handle(DefaultAsyncHandler.java:145) at com.sun.grizzly.arp.AsyncProtocolFilter.execute(AsyncProtocolFilter.java:204) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:679) "
I am new developer in java. I have googled so much for fix this issue but i am unable to fix this :(
If someone knows how to fix this websocket connection issue? please help me.

I have attached the my source code contaning used .jar file.

AttachmentSize
websocket-example.zip1.42 MB