javax.websocket.DeploymentException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer
Asked Answered
S

2

5

I am trying to create a websocket using the tyrus project. I am getting this below error:

java.lang.RuntimeException: javax.websocket.DeploymentException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer

    at org.glassfish.tyrus.client.ClientManager.<init>(ClientManager.java:272) ~[bundlefile:na]
    at org.glassfish.tyrus.client.ClientManager.createClient(ClientManager.java:240) ~[bundlefile:na]
    at org.glassfish.tyrus.client.ClientManager.createClient(ClientManager.java:219) ~[bundlefile:na]

My pom dependency looks like this:

<dependency>
    <groupId>org.glassfish.tyrus</groupId>
    <artifactId>tyrus-client</artifactId>
    <version>1.12</version>
</dependency>
<dependency>
    <groupId>org.glassfish.tyrus</groupId>
    <artifactId>tyrus-core</artifactId>
    <version>1.12</version>
</dependency>
<dependency>
    <groupId>org.glassfish.tyrus</groupId>
    <artifactId>tyrus-spi</artifactId>
    <version>1.12</version>
</dependency>
<dependency>
    <groupId>javax.websocket</groupId>
    <artifactId>javax.websocket-api</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>javax.websocket</groupId>
    <artifactId>javax.websocket-client-api</artifactId>
    <version>1.1</version>
</dependency>

Very simple java code :

    logger.info("Creating web socket for url {}", getWebSocketUrl(currentApic.IPAddress, port));
    echoUri = new URI(getWebSocketUrl(currentApic.IPAddress, port));
    client = ClientManager.createClient();
    client.connectToServer(APICWebClient.class, echoUri);

if i try to add the container dependency

<dependency>
    <groupId>org.glassfish.tyrus</groupId>
    <artifactId>tyrus-container-grizzly-server</artifactId>
    <version>1.12</version>
</dependency>

My mvn clean install fails saying :

 Failed to read artifact descriptor for org.glassfish.tyrus:tyrus-container-grizzly-server:jar:1.4: Could not transfer artifact org.glassfish.tyrus:tyrus-container-grizzly-server:pom:1.4 from/to central (http://repo1.maven.org/maven2): repo1.maven.org: unknown error: Unknown host repo1.maven.org: unknown error -> [Help 1]

Edited: The above issue is resolved after mvn clean. server container and client container packages are added. but still i am getting the same runtime error java.lang.RuntimeException: javax.websocket.DeploymentException: org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer

I am using the in OSGi environment. How do i solve this. need some help on this.

Steamer answered 15/6, 2016 at 18:56 Comment(1)
For the last issue, Unknown host repo1.maven.org, resolved by doing mvn clean and mvn clean installSteamer
S
7

The container org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer is missing on classpath. Add the maven module tyrus-container-grizzly-client.

And yes, the exception thrown by tyrus might be more accurate.

Snippet answered 17/6, 2016 at 10:24 Comment(2)
i have tried adding that also. But still the same errorSteamer
Make sure you added tyrus-container-grizzly-client, not tyrus-container-grizzly.Primus
M
0

use, org.glassfish.tyrus tyrus-container-grizzly-client 1.17

Mcalpin answered 18/3 at 7:13 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Terriss

© 2022 - 2024 — McMap. All rights reserved.