tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sambit nayak <sambit...@gmail.com>
Subject Facing issue with web socket client in Tomcat 7
Date Wed, 04 Nov 2015 05:49:57 GMT
Hi

I am trying to run a Web socket client under the context of Tomcat. So the
scenario is, I have a Web socket Server Endpoint deployed on Tomcat, as
part of App-1. App-2, which is also deployed on Tomcat (obviously under
different context root), wants to send a message.

The class in App-2 works fine, if I run it as a stand alone from a main
method. But it gives the below error, when it runs under context of tomcat.
(I am using Tyrus 1-9 as JSR-356 impl. If I remove it from pom dependency
list, @clientEndpoint and related annotations are not identified.)

> java.util.ServiceConfigurationError: javax.websocket.ContainerProvider:
> Provider org.apache.tomcat.websocket.WsContainerProvider not a subtype
> at java.util.ServiceLoader.fail(ServiceLoader.java:239)
> at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
> at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
> at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
> at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
> at
> javax.websocket.ContainerProvider.getWebSocketContainer(ContainerProvider.java:66)

The above exception is thrown at this line: WebSocketContainer container =
ContainerProvider.getWebSocketContainer();

I have tried below methods:


   - From javax.websocket.ContainerProvider documentation

"Provider class that allows the developer to get a reference to the
implementation of the WebSocketContainer. The provider class uses the
ServiceLoader
<http://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html> to
load an implementation of ContainerProvider. Specifically, the fully
qualified classname of the container implementation of ContainerProvider
must be listed in the META-INF/services/javax.websocket.ContainerProvider
file in the implementation JAR file.

 I looked in the META-INF of tomcat7-websocket.jar and tried changing the
entry to another impl class in Tyrus (GrizzlyContainerProvider), but that
does not help.


   - Change the above line to

WebSocketContainer container = GrizzlyContainerProvider.getWebSocketContainer();

Both methods do not work.Any suggestion on how to fix this will be very
helpful.

I am running Tomcat 7.0.54 on Mac OS X 10.10.5.

Thanks & Regards
Sambit Nayak

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message