J2EE containers allow direct server sockets?
I have a question, that may sound strange.
I am interested to know if J2EE containers allow to the applications deployed, to open direct server sockets (by-passing essentially the container) for their own purposes. I know that it is strange to want to do that, but the reason I am asking is because, I have read that a javax.xml.endoint can not be started in a container, and was wondering if this is the reason.UPDATE:The answers for this POST, seem contradicting to me. The one answer (by andri) refers to EJB specification that it is forbidden, yet the other answer by Codemwnci (backed up by a comment from Hippo) says开发者_JAVA百科 that it is something used in production. I am not sure what to conclude from this posts. Can anyone help on clearing this?
Thank you.
I have a web application that runs on the WebSphere application server (WAS 7). In one of the applications, as part of a servlet that runs when the application starts, I create a ServerSocket.
This is running in a large scale production environment and has worked for many years.
Strictly speaking, it is forbidden by the EJB specification, just as managing your own threads is forbidden:
An enterprise bean must not attempt to listen on a socket, accept connections on a socket, or use a socket for multicast.
The likely reason for disallowing this are distributed applications and moving EJBs between application server instances. The "official" solution for opening a raw socket is to write a JCA connector.
精彩评论