与套接字通信 EJB 项目和 java 应用程序?
communicate EJB project and java application with socket?
我需要我的 EJB 通过套接字与 java 应用程序通信。这可以做到吗?我可以将客户端套接字的代码放在 Bean 中的某处(在方法中吗?)并让服务器代码建立连接并侦听 java 应用程序上来自客户端的请求?
感谢您的帮助!
参见 EJB 规范(例如 EJB 3.2 核心,第 16.2.2 章"Programming Restrictions":
An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or use a socket for multicast.
The EJB architecture allows an enterprise bean instance to be a network socket client, but it does not allow it to be a network server. Allowing the instance to become a network server would conflict with the basic function of the enterprise bean— to serve the EJB clients.
我需要我的 EJB 通过套接字与 java 应用程序通信。这可以做到吗?我可以将客户端套接字的代码放在 Bean 中的某处(在方法中吗?)并让服务器代码建立连接并侦听 java 应用程序上来自客户端的请求? 感谢您的帮助!
参见 EJB 规范(例如 EJB 3.2 核心,第 16.2.2 章"Programming Restrictions":
An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or use a socket for multicast. The EJB architecture allows an enterprise bean instance to be a network socket client, but it does not allow it to be a network server. Allowing the instance to become a network server would conflict with the basic function of the enterprise bean— to serve the EJB clients.