如何将Tyrus(JSR 356实现)部署到Web容器? [英] How to deploy Tyrus (JSR 356 implementation) to a web container?

查看:98
本文介绍了如何将Tyrus(JSR 356实现)部署到Web容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Tyrus部署到Tomcat 8容器,但是失败了。根据文档,我应该能够部署包含我的类并支持Tyrus类/依赖项的WAR,并且所有用@ServerEndpoint注释的类都应该在WAR中找到并部署为websocket端点。该指令让我有些不满意,因为我没有在部署描述符中定义任何类型的过滤器,而是决定必须以某种未知的方式依赖于Tomcat 8中对JSR 356的支持。事实证明,没有任何方法可以解决。如此神奇。注意:我使用的是Tomcat 8,因为我的理解是它支持JSR 356 websocket标准。另外,我的JDK是Java 7的最新版本。



我花了一些时间对此进行了研究,并发现人们可以通过运行Tyrus成功地通过Tyrus发布websocket端点。命令行中作为Java应用程序的Server(org.glassfish.tyrus.server.Server)服务器实例。我已经尝试过了,并且有效。但是,我找不到在Tomcat上部署WAR的任何成功。



是否有人对通过Tyrus在Tomcat上成功发布Websocket端点所需的步骤有任何了解? 8?

解决方案

Apache Tomcat 7.0和更高版本(以及Eclipse Jetty 9.1)具有对JSR-356(又名 javax.websocket )。



在大多数JEE7容器上都不需要使用Tyrus兼容性层。



只需跳过整个Tyrus配置问题,并使用提供 javax.websocket 支持的内置功能。<​​/ p>


I am attempting to deploy Tyrus to a Tomcat 8 container and am failing. According to the documentation, I should be able to deploy a WAR containing my classes and supporting Tyrus classes/dependencies and all classes annotated with @ServerEndpoint should be found in the WAR and deployed as websocket end points. This instruction threw me a little because I'm not defining any sort of filter in the deployment descriptor but decided that I must be somehow depending on some unknown magic in the support of JSR 356 in Tomcat 8. As it turns out, there is no such magic. NOTE: I'm using Tomcat 8 because my understanding is that it supports the JSR 356 websocket standard. Also, my JDK is the latest Java 7 version.

I have spent some time researching this and have found that people are successful in publishing websocket end points with Tyrus by running an instance of a Server (org.glassfish.tyrus.server.Server) as a Java application from the command line. I have tried this and it works. However, I'm unable to find any success deploying a WAR on Tomcat.

Does anyone have any insight into the steps required to successfully publish websocket end points via Tyrus on Tomcat 8?

解决方案

Apache Tomcat 7.0 and later (and Eclipse Jetty 9.1) has built-in support for JSR-356 (aka javax.websocket).

There is no need to use the Tyrus compatibility layer on most JEE7 containers.

Just skip the entire Tyrus configuration issue and use the built-in features that expose javax.websocket support.

这篇关于如何将Tyrus(JSR 356实现)部署到Web容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆