Discussions

EJB design: Applet /EJB Problem

  1. Applet /EJB Problem (2 messages)

    Let me explain what is happening.

    1. We load a JSP that contains an applet in an IE browser session.
    2. The applet initialises, loads, gets data from the database and
    displays/functions correctly.
    3. This involves instantiating an EJB from the applet code, which
    accesses
    the database, and calls a method(s) on the EJB.
    4. When we check the connections on the database everything is as
    expected.
    A user session has been established for the EJB.
    5. When we leave the JSP i.e. load another page into the IE browser, the

    database session remains open on the DB server.
    6. When we try and go back to the same JSP with the applet tag within
    the
    same IE session, the IE browser hangs while trying to initialise the
    applet.
    7. We can see that no new connection is established in the database and
    we
    can also see from the last activity date that the original one is not
    being
    re-used.
    8. This happens consistently. First time from a new IE session always
    works, subsequent access hangs!

    If any of you have any solution for this, Please reply
    immediately.

    Threaded Messages (2)

  2. Connection Ppoling[ Go to top ]

    HI Krishna Mohan

    Try using Connection Pooling. Im quite sure that this will solve ur problem. Just hold a pool of connections in some collection class, keep releasing and adding connections when the situation demands. Like say during the 'init' method of ur class loading do this, that will return u back a connection object and so when u close the browser release the connection to the pool - basically add the 'conn' object to the collection class - preferably a Vector.

    Try this and let me know if it still comes.

    Best wishes

    Arun
  3. There is a connection pool library which I found to be useful called www.bitmechanic.com. It releases a connection automatically if a connection is idle for 'x' amount of time.