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

时间:2016-06-15 18:56:02

标签: websocket osgi tyrus

我正在尝试使用tyrus项目创建一个websocket。我收到以下错误:

def g(c,d):
    return scipy.integrate.dblquad(f, 0, 1, lambda x: 0, lambda x: 2, args=(c,d))

我的pom依赖关系如下:

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]

非常简单的java代码:

<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>

如果我尝试添加容器依赖

    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);

我的mvn clean安装失败说:

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

编辑:上面的问题在mvn clean之后解决了。添加了服务器容器和客户端容器包。但我仍然得到相同的运行时错误     java.lang.RuntimeException:javax.websocket.DeploymentException:org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer

我在OSGi环境中使用。我该如何解决这个问题。需要一些帮助。

1 个答案:

答案 0 :(得分:5)

类路径中缺少容器org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer。 添加maven模块tyrus-container-grizzly-client

是的,tyrus抛出的异常可能更准确。