I need my EJB to communicate via sockets with a java application. Can this be done? Can I place the code for a client socket somewhere in the Bean (in a method?) and have the server code establish a connection and listen for requests from client on the java application? Thanks for the help!
See the EJB spec (e.g. EJB 3.2 core, chapter 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.