Websocket connection not establishing in glasshfish server. How to fix it?
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.
| Attachment | Size |
|---|---|
| websocket-example.zip | 1.42 MB |
hi
Thanks for reply and help. I have installed latest netbeans with glassfish server 3.1.2. i downloaded it from here http://bits.netbeans.org/download/trunk/nightly/latest/ . Now connection is establishing error is solved.
Now websocket connection opens successfully in mozilla but when i sends message to websocket servlet its doesent invokes the serverside functionality. Its not giving any error also. I tried to debug in netbeans but its not going in websocket servlet.
i dont know what is the issue.
Please have look my attached project.
Thanks
Abhijit
The example code you're using is outdated as well and won't run against
3.1.2.
When compiling your code, I would recommend using the Grizzly libraries
included
in the modules directory of the GF server you're running against (in
this case, 3.1.2).
Given this, please see [1] and [2] for an up-to-date version of the chat
example.
[1]
https://maven.java.net/service/local/artifact/maven/redirect?r=releases&...
[2]
https://maven.java.net/service/local/artifact/maven/redirect?r=releases&...
On 2/20/12 1:49 AM, forums@java.net wrote:
>
>
> hi
>
> Thanks for reply and help. I have installed latest netbeans with
> glassfish
> server 3.1.2. i downloaded it from here
> http://bits.netbeans.org/download/trunk/nightly/latest/ [1] . Now
> connection
> is establishing error is solved.
>
> Now websocket connection opens successfully in mozilla but when i sends
> message to websocket servlet its doesent invokes the serverside
> functionality. Its not giving any error also. I tried to debug in
> netbeans
> but its not going in websocket servlet.
>
> i dont know what is the issue.
>
> Please have look my attached project.
>
> Thanks
>
> Abhijit
>
>
>
>
>
>
> [1] http://bits.netbeans.org/download/trunk/nightly/latest/
>
> --
>
> [Message sent by forum member 'abhijitaitwade']
>
> View Post: http://forums.java.net/node/883623
>
>
hi rlubke,
Thanks you so much! Its works.
My websocket chatting application working successfully with grizzly 1.9.46.
thanks once again.
regards
Abhijit
GF 3.1.2 RC5 is out [1] . Is there any reason not to try that one instead?
-Noah
[1] - https://blogs.oracle.com/theaquarium/entry/final_rc_5_for_glassfish
On Feb 18, 2012, at 1:56 PM, Ryan Lubke wrote:
> The WebSocket support in 3.1.1 is dated. Please try your example with the latest 3.1.2 RC (download link available on glassfish.java.net).
>
>
> On 2/18/12 4:10 AM, forums@java.net wrote:
>>
>>
>> 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.
>>
>>
>>
>>
>> --
>>
>> [Message sent by forum member 'abhijitaitwade']
>>
>> View Post: http://forums.java.net/node/883623
>>
>>
>
hi
Thanks for reply and help. I have installed latest netbeans with glassfish server 3.1.2. i downloaded it from here http://bits.netbeans.org/download/trunk/nightly/latest/ . Now connection is establishing error is solved.
Now websocket connection opens successfully in mozilla but when i sends message to websocket servlet its doesent invokes the serverside functionality. Its not giving any error also. I tried to debug in netbeans but its not going in websocket servlet.
i dont know what is the issue.
in above reply i have attached my project.
Thanks
Abhijit





The WebSocket support in 3.1.1 is dated. Please try your example with
the latest 3.1.2 RC (download link available on glassfish.java.net).
On 2/18/12 4:10 AM, forums@java.net wrote:
>
>
> 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.
>
>
>
>
> --
>
> [Message sent by forum member 'abhijitaitwade']
>
> View Post: http://forums.java.net/node/883623
>
>