users@tyrus.java.net

Re: Websocket can not find the endpoint

From: Neil Ghosh <neil.ghosh_at_gmail.com>
Date: Fri, 22 Feb 2013 10:03:29 +0530

Hi Arun,

This latest code works now (76). I observed that the endpoint definition
has changed

@WebSocketEndpoint(value = "/slate", configuration =
DefaultServerConfiguration.class)

I have been using @WebSocketEndpoint(value = "/slate", factory =
Slate.DummyEndpointFactory.class) all these days.

Also the the websocket endpoint is in
javax.websocket.server.WebSocketEndpoint; instead of
javax.websocket.WebSocketEndpoint;

I don't know whats the best way to communicate these changes as they happen
build by build.



BTW Even after these changes my code did not work. It gave following
exception

INFO: Loading application [com.mycompany_slate_war_1.0-SNAPSHOT] at [/slate]
INFO: com.mycompany_slate_war_1.0-SNAPSHOT was successfully deployed in
1,080 milliseconds.
INFO: Registering WebSocket filter for url pattern /*
INFO: Initializing Mojarra 2.2.0-m09 (-SNAPSHOT 20130205-1620
https://svn.java.net/svn/mojarra~svn/tags/2.2.0-m09@11568) for context
'/slate'
INFO: Closing down : org.glassfish.tyrus.server.TyrusEndpoint_at_36c9cd3d
*SEVERE: WebModule[/slate]Exception starting filter WebSocket filter
java.lang.InstantiationException*
    at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:135)
    at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:5290)
    at
org.apache.catalina.core.StandardContext.start(StandardContext.java:5902)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:696)
    at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
    at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
    at
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2304)
    at
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1950)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:140)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
    at
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:327)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:528)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:524)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:523)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:547)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1424)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1759)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1675)
    at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at
com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at
org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
    at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at
org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
    at
org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
    at
org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:273)
    at
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
    at
org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
    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:820)
    at
org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:722)
Caused by: javax.servlet.ServletException: Web socket server initialization
failed.
    at
org.glassfish.tyrus.servlet.TyrusServletFilter.init(TyrusServletFilter.java:101)
    at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
    at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:131)
    ... 45 more
Caused by: javax.websocket.DeploymentException: Class
javax.websocket.server.DefaultServerConfiguration couldn't be instantiated
    at
org.glassfish.tyrus.ErrorCollector.composeComprehensiveException(ErrorCollector.java:83)
    at
org.glassfish.tyrus.server.TyrusServerContainer.start(TyrusServerContainer.java:138)
    at
org.glassfish.tyrus.servlet.TyrusServletFilter.init(TyrusServletFilter.java:99)
    ... 47 more

INFO: Loading application [com.mycompany_slate_war_1.0-SNAPSHOT] at [/slate]
INFO: com.mycompany_slate_war_1.0-SNAPSHOT was successfully deployed in 855
milliseconds.





On Thu, Feb 21, 2013 at 6:07 AM, Arun Gupta <arun.p.gupta_at_oracle.com> wrote:

> Hi Neil,
>
> You had these apps working on an earlier version of GlassFish, right ? Are
> they still working in that version ?
>
> BTW, the Collaborative Whiteboard sample was broken on b76 and the updated
> code is now available at:
>
>
> https://blogs.oracle.com/arungupta/resource/totd189-whiteboard-glassfish76.zip
>
> Arun
>
>
> On 2/19/13 11:17 PM, Neil Ghosh wrote:
>
> I used the the following code in Glassfish build 76
>
>
> https://blogs.oracle.com/arungupta/resource/totd189-whiteboard-glassfish74.zip
>
> I saw the following error in browser web console
>
> [12:41:22.599] Firefox can't establish a connection to the server at
> ws://localhost:8080/whiteboard/websocket. @
> http://localhost:8080/whiteboard/websocket.js:42
>
> The same error happens to all my other test apps. Can this be a firewall
> issue ?
> How do I debug this ?
>
> Note I did update the dependency while building the project via POM.
>
> --
> Thanks and Regards
> Neil
> http://neilghosh.com
>
>
>
> -- http://twitter.com/arunguptahttp://blogs.oracle.com/arungupta
>
>


-- 
Thanks and Regards
Neil
http://neilghosh.com