tag:blogger.com,1999:blog-14415229.post115071048694086836..comments2023-10-10T16:55:02.139+02:00Comments on Chase The Devil: On EJB Restrictions - Can You Open a Socket?Fabienhttp://www.blogger.com/profile/07288327695801480778noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-14415229.post-69338730930362012052011-02-23T15:05:46.614+01:002011-02-23T15:05:46.614+01:00I think you can trust Gavin's answer as he was...I think you can trust Gavin's answer as he was part of the EJB3 expert group.Fabienhttps://www.blogger.com/profile/07288327695801480778noreply@blogger.comtag:blogger.com,1999:blog-14415229.post-67739481446617154102011-02-22T15:44:12.219+01:002011-02-22T15:44:12.219+01:00Is there any solution to this problem? Not ONE pla...Is there any solution to this problem? Not ONE place on the entire internet is a real tutorial for doing this. It's all assumptions and maybe this and maybe that. Many say that you should use JCA, but that seems a minor (UNDERSTATEMENT) overkill if you only would like to communicate back and forth with a homebrew c++ application?Frankhttp://frako@villey.co.jpnoreply@blogger.comtag:blogger.com,1999:blog-14415229.post-1150759070755316822006-06-20T01:17:00.000+02:002006-06-20T01:17:00.000+02:00With an EJB3 Entity Bean you can define attributes...With an EJB3 Entity Bean you can define attributes/fields as transient... This way i don't see a reason why it can't be done.. <BR/><BR/>I don't see a reason to keep all these filehandles open when the entity itself is persisted though.. So i would probably use EntityCallBackHandlers in order to reestablish the conenctions when the objects are loaded again...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-14415229.post-1150741496886953652006-06-19T20:24:00.000+02:002006-06-19T20:24:00.000+02:00My guess is that if you want to _listen_ on a sock...My guess is that if you want to _listen_ on a socket, you need to create a JCA connector (a RAR), and wire it up to an MDB.<BR/><BR/>-- GavinAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-14415229.post-1150735971294151912006-06-19T18:52:00.000+02:002006-06-19T18:52:00.000+02:00[References to the EJB 2.1 specification appear in...[References to the EJB 2.1 specification appear in parentheses]<BR/><BR/>The most obvious question is: are we talking about an outbound connection socket, or are we talking about listening on a socket?<BR/><BR/>Listening on a socket is not allowed (25.1.2).<BR/><BR/>Making outbound socket connections <I>is</I> allowed (25.2.1, table 23). The EJB should make outbound connections through a java.net.URL. It's not clear to me if it's legitimate for an EJB to make a non-URL socket connection; my guess is that it's not although you'd probably get away with it.<BR/><BR/>The EJB must obtain the URL through a URL connection factory (20.5.1.3).<BR/><BR/>The EJB obtains the URL connection factory via a resource-ref entry in the bean's deployment descriptor (B.5).<BR/><BR/>The factory itself is defined in a container-specific way, and it is recommended but not required that the URL connection factory be placed in the java:comp/env/url subcontext (20.5.1.1).<BR/><BR/>Custom socket factories are not allowed (25.1.2).<BR/><BR/>Socket connections must be closed if a stateful bean is passivated (7.4). Interestingly, this requirement only appears under stateful session beans but I don't see why it wouldn't apply to entity beans as well.Doughttps://www.blogger.com/profile/03387544320506615807noreply@blogger.comtag:blogger.com,1999:blog-14415229.post-1150718615916550402006-06-19T14:03:00.000+02:002006-06-19T14:03:00.000+02:00I can't give a totally authorative answer on this,...I can't give a totally authorative answer on this, but when it has come up in the EJB3 expert group, the conclusion has always been that EJBs definitely are allowed to open sockets.<BR/><BR/>-- GavinAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-14415229.post-1150716962649100722006-06-19T13:36:00.000+02:002006-06-19T13:36:00.000+02:00I think a lot of constrains have the orgin in the ...I think a lot of constrains have the orgin in the opportunity of the ejb container to cluster the Beans. Because the container must replicate the state it is difficult with thinks like files, sockets, ...<BR/><BR/> ChristianAnonymousnoreply@blogger.com