如何从 Java EE 应用程序提供套接字? [英] How to serve a socket from a Java EE application?
问题描述
我们希望在我们的 Java EE 应用服务器 (JBoss 4.2.3) 中处理一些客户端请求.我读到 Java EE 规范不允许从一个企业 bean.但规范建议没有替代方案.
We would like to serve some client requests within our Java EE application server (JBoss 4.2.3). I read that the Java EE spec doesn't allow opening a socket from an enterprise bean. But the spec suggests no alternatives.
具体来说,企业 bean 不应该:
Specifically, enterprise beans should not:
- 从网络套接字监听、接受连接或多播
所以问题是:我该怎么做才能从应用服务器中提供一些基于二进制 tcp 的协议(不是 http)?
So the question is: What can I do to serve some binary tcp based protocols (not http) from within an application server?
这里 有人建议实施 资源适配器.这是您必须采用的方式还是有其他(更简单的)解决方案?
Here someone suggests to implement a resource adapter. Is this the way you have to go or are there other (easier) solutions?
推荐答案
现在我实施了一个解决方法:
Right now I implement a workaround:
我使用一个独立的 java 应用程序,它接受来自客户端的 tcp 调用并将它们作为 JNDI 调用转发到应用程序服务器.
I use a standalone java application that accepts tcp calls from the client and forwards them as JNDI calls to the application server.
这篇关于如何从 Java EE 应用程序提供套接字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!