Please Help: I am not sure whether EJB can call classes: URL, URLConnection, ObjectInputStream, DataInputStream, etc since EJB are not allowed to open socket and make network calls. Please clarify the problem for me, Thanks Ruilin
EJB is not allowed to make socket connection. Therefore, I confused if EJB can call URL and URLConnection classes to write to or read from a URL ? Please help Thanks Ruilin
From the specification: 20.4.1.3 Standard resource manager connection factory types The Bean Provider must use the javax.sql.DataSource resource manager connection factory type for obtaining JDBC connections, and the javax.jms.QueueConnectionFactory or the javax.jms.TopicConnectionFactory for obtaining JMS connections. The Bean Provider must use the javax.mail.Session resource manager connection factory type for obtaining JavaMail connections, and the java.net.URL resource manager connection factory type for obtaining URL connections. It is recommended that the Bean Provider names JDBC data sources in the java:comp/env/jdbc subcontext, and JMS connection factories in the java:comp/env/jms subcontext. It is also recom-mended that the Bean Provider names all JavaMail connection factories in the java:comp/env/mail subcontext, and all URL connection factories in the java:comp/env/url subcontext. The Connector architecture [12] allows an enterprise bean to use the API described in this section to obtain resource objects that provide access to additional back-end systems.
Actually the limitation is that an EJB cannot be a socket server -- it's not allowed to wait for connections since that not only suspends the client, but also anyone else queued up waiting to use the EJB. Use sockets carefully (and in conformance with the EJB spec). Even when they're legal, they tend to slow down response time just because they're sockets. If they slow it down too much, the client may time out.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.