Discussions

EJB programming & troubleshooting: How to use HTTPS to post a message inside a EJB bean

  1. How to use HTTPS to post a message inside a EJB bean (1 messages)

    I created a stateless session bean which is deployed on WebLogic 5.1. The bean will try to post a message using HTTPS, which I bought from a third party. It seems like the posting part is fine but when the bean tries to get the InputStream from the URLConnection object, it blocks until it times out.
    Anybody has any ideas? Suggestion?
    BTW, the program works fine out the application server.
    Thanks in advance.
    -- Lei
  2. Hi,

    The problem is that you are violation the container principle. According to the specification of Sun, there are a number of programming restrictions.
    <SUN EJB 2.0 SPEC>
    The enterprise bean must not attempt to set the socket factory used by ServerSocket, Socket, or
    the stream handler factory used by URL.
    <ANSWER>
    These networking functions are reserved for the EJB Container. Allowing the enterprise bean to use
    these functions could compromise security and decrease the Container&#8217;s ability to properly manage the
    runtime environment.
    </ANSWER>
    </SUN EJB 2.0 SPEC>
    This means that you are not able to use the libraries that you have bought but that you are stuck what weblogic provides us.

    Take a look at
    http://www.weblogic.com/docs51/classdocs/API_ejb/EJB_environment.html
    Topic
    Setting up URL connection factories