See if you are following the examples shown on tomcat7.0 docs then you are
wasting time. The JSR is not yet implemented in tomcat but the examples
shown are according to JSR that is currently open. Tomcat7.0 has a
propitiatory solution for websockets. if you want to use websockets study
the examples that comes with the tomcat distribution. That will help you to
use websockets in tomcat7.


On Mon, Apr 8, 2013 at 2:41 PM, <eric.rober...@free.fr> wrote:

> Hi all !
>
> I would like to use web socket, and I started looking to do so with tomcat
> API.
> I'm currently using Tomcat 7.0.37 on Windows Seven, integrated in Eclipse
> Juno.
>
> I tried to follow the example code from tomcat documentation, and read the
> associated JavaDoc for package org.apache.catalina.websocket. The example
> is
> supposed to be a chat application. Here is the link for the documentation :
> http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html
>
>
> I'm also using maven for the project, so I added this to my pom.xml :
>
> <dependency>
>     <groupId>org.apache.tomcat</groupId>
>     <artifactId>tomcat-catalina</artifactId>
>     <version>7.0.39</version>
>     <scope>provided</scope>
> </dependency>
>
> First thing that's weird, I get an error message in Eclipse for this line :
>
> private class MyMessageInbound extends MessageInbound
>
> The error message is "The hierarchy of the type MyMessageInbound is
> inconsistent",
> but I'm still able to compile and launch the webapp from Eclipse.
>
> I also added the configuration in the web.xml as follow:
>
> <servlet>
>     <servlet-name>wsChat</servlet-name>
>     <servlet-class>websocket.chat.ChatWebSocketServlet</servlet-class>
>     <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
>     <servlet-name>wsChat</servlet-name>
>     <url-pattern>/websocket/chat</url-pattern>
> </servlet-mapping>
>
> So, I'm able to launch the webapp, but when I go to the chat page, I get
> an error
> on the chat board saying "Info: WebSocket closed.". Tomcat log give me the
> following message:
>
> SEVERE: Servlet.service() for servlet [wsChat] in context with path
> [/websocket-tuto] threw exception [L''exécution de la servlet a lancé une
> exception]
> with root cause
> java.lang.NoSuchMethodError:
> websocket.chat.ChatWebSocketServlet$MyMessageInbound.<init>(Lwebsocket/chat/ChatWebSocketServlet;Luwebsocket/chat/ChatWebSocketServlet$MyMessageInbound;)V
> at
> websocket.chat.ChatWebSocketServlet.createWebSocketInbound(ChatWebSocketServlet.java:34)
> at
> org.apache.catalina.websocket.WebSocketServlet.doGet(WebSocketServlet.java:121)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
> at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
>
> Anyone see what could be my problem, or what I'm doing wrong ?
>
> Thanks !
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


-- 
Thanks And Regards,
*Muralidhar Yaragalla.
*

Reply via email to