Java beans: application scope and HTTP sessions - Weblogic

This is a discussion on Java beans: application scope and HTTP sessions - Weblogic ; Hello everyone, Our application requires that if a user connects with a username and a password, we should check if there's another user connected with the same profile. If there's another user connected with the same profile, we should kick ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Java beans: application scope and HTTP sessions

  1. Java beans: application scope and HTTP sessions

    Hello everyone,

    Our application requires that if a user connects with a username and a
    password, we should check if there's another user connected with the
    same profile. If there's another user connected with the same profile,
    we should kick him out and let the new user login.

    I have two problems:

    1) I'm filling the http sessions inside a hashmap java bean given the
    application scope.

    I noticed that every managed server has his own instance of the hashmap
    as here we have different JVMs. But how can I synchronize both objects??

    2) In the case where I want to kick the user out, I'm invalidating the
    HttpSession of the first user. The problem, is again , that the session
    object exists on the first server and not on any managed server??

    Would session replication help me in that case?

    As I understood, session in-memory replication works on primary and
    secondary servers, what if I have three managed servers??

    Another simular question: Would a stateless session bean be shared with
    the managed servers, same instance?? if that's the case, that would help
    me with point 1

    --
    Itani Mohamed

    SoftSolutions
    Tel: +961.1.90.11.70 ext:141
    Fax: +961.1.90.11.75
    www.softsolutions.fr



  2. Re: Java beans: application scope and HTTP sessions

    I suggest taking advantage of shared resource like database. A scheme like
    the following:
    o upon login check the user if they already exists in the database
    o if they exists, stop
    o otherwise, upon login write the username to the database
    o upon logout / session time out remove the user from the database

    "Mohamed Itani" wrote in message
    news:3FD5D9B9.21CA1704@softsolutions.fr...
    > Hello everyone,
    >
    > Our application requires that if a user connects with a username and a
    > password, we should check if there's another user connected with the
    > same profile. If there's another user connected with the same profile,
    > we should kick him out and let the new user login.
    >
    > I have two problems:
    >
    > 1) I'm filling the http sessions inside a hashmap java bean given the
    > application scope.
    >
    > I noticed that every managed server has his own instance of the hashmap
    > as here we have different JVMs. But how can I synchronize both objects??
    >
    > 2) In the case where I want to kick the user out, I'm invalidating the
    > HttpSession of the first user. The problem, is again , that the session
    > object exists on the first server and not on any managed server??
    >
    > Would session replication help me in that case?
    >
    > As I understood, session in-memory replication works on primary and
    > secondary servers, what if I have three managed servers??
    >
    > Another simular question: Would a stateless session bean be shared with
    > the managed servers, same instance?? if that's the case, that would help
    > me with point 1
    >
    > --
    > Itani Mohamed
    >
    > SoftSolutions
    > Tel: +961.1.90.11.70 ext:141
    > Fax: +961.1.90.11.75
    > www.softsolutions.fr
    >
    >




  3. Re: Java beans: application scope and HTTP sessions


    What about using JNDI to store the hashtable that contains the sessions? The JNDI
    tree is available cluster-wide and I believe WebLogic synchronizes the contents
    of the tree across the managed servers for every instance the tree changes in
    any managed server. The documentation, however, warns against using the JNDI tree
    as a cache for storing application-specific data. I remember reading on Yahoo
    Groups that it is possible to use JNDI to control the number of instances created
    for a singleton class across a cluster, so I would think the same concept would
    apply in this case.

    Raffi

    "Carl" wrote:
    >I suggest taking advantage of shared resource like database. A scheme
    >like
    >the following:
    >o upon login check the user if they already exists in the database
    >o if they exists, stop
    >o otherwise, upon login write the username to the database
    >o upon logout / session time out remove the user from the database
    >
    >"Mohamed Itani" wrote in message
    >news:3FD5D9B9.21CA1704@softsolutions.fr...
    >> Hello everyone,
    >>
    >> Our application requires that if a user connects with a username and

    >a
    >> password, we should check if there's another user connected with the
    >> same profile. If there's another user connected with the same profile,
    >> we should kick him out and let the new user login.
    >>
    >> I have two problems:
    >>
    >> 1) I'm filling the http sessions inside a hashmap java bean given the
    >> application scope.
    >>
    >> I noticed that every managed server has his own instance of the hashmap
    >> as here we have different JVMs. But how can I synchronize both objects??
    >>
    >> 2) In the case where I want to kick the user out, I'm invalidating

    >the
    >> HttpSession of the first user. The problem, is again , that the session
    >> object exists on the first server and not on any managed server??
    >>
    >> Would session replication help me in that case?
    >>
    >> As I understood, session in-memory replication works on primary and
    >> secondary servers, what if I have three managed servers??
    >>
    >> Another simular question: Would a stateless session bean be shared

    >with
    >> the managed servers, same instance?? if that's the case, that would

    >help
    >> me with point 1
    >>
    >> --
    >> Itani Mohamed
    >>
    >> SoftSolutions
    >> Tel: +961.1.90.11.70 ext:141
    >> Fax: +961.1.90.11.75
    >> www.softsolutions.fr
    >>
    >>

    >
    >



  4. Re: Java beans: application scope and HTTP sessions

    That won't work. If I found that the user is connected, I need to kill the
    session of the first user (Otherwise, he'll continue working normally). I
    cannot rely on timeout. Session invalidation works perfectly in my case but not
    in cluster mode.

    I was reading some documentation about ClusterListener implementation in
    weblogic where u can use a java bean with the scope cluster.

    Well, I added the following to my web.xml:



    weblogic.cache.listener.ClusterListener



    and still, the server is not accepting the cluster scope.

    Anybody tried that?

    Raffi Basmajian wrote:

    > What about using JNDI to store the hashtable that contains the sessions? The JNDI
    > tree is available cluster-wide and I believe WebLogic synchronizes the contents
    > of the tree across the managed servers for every instance the tree changes in
    > any managed server. The documentation, however, warns against using the JNDI tree
    > as a cache for storing application-specific data. I remember reading on Yahoo
    > Groups that it is possible to use JNDI to control the number of instances created
    > for a singleton class across a cluster, so I would think the same concept would
    > apply in this case.
    >
    > Raffi
    >
    > "Carl" wrote:
    > >I suggest taking advantage of shared resource like database. A scheme
    > >like
    > >the following:
    > >o upon login check the user if they already exists in the database
    > >o if they exists, stop
    > >o otherwise, upon login write the username to the database
    > >o upon logout / session time out remove the user from the database
    > >
    > >"Mohamed Itani" wrote in message
    > >news:3FD5D9B9.21CA1704@softsolutions.fr...
    > >> Hello everyone,
    > >>
    > >> Our application requires that if a user connects with a username and

    > >a
    > >> password, we should check if there's another user connected with the
    > >> same profile. If there's another user connected with the same profile,
    > >> we should kick him out and let the new user login.
    > >>
    > >> I have two problems:
    > >>
    > >> 1) I'm filling the http sessions inside a hashmap java bean given the
    > >> application scope.
    > >>
    > >> I noticed that every managed server has his own instance of the hashmap
    > >> as here we have different JVMs. But how can I synchronize both objects??
    > >>
    > >> 2) In the case where I want to kick the user out, I'm invalidating

    > >the
    > >> HttpSession of the first user. The problem, is again , that the session
    > >> object exists on the first server and not on any managed server??
    > >>
    > >> Would session replication help me in that case?
    > >>
    > >> As I understood, session in-memory replication works on primary and
    > >> secondary servers, what if I have three managed servers??
    > >>
    > >> Another simular question: Would a stateless session bean be shared

    > >with
    > >> the managed servers, same instance?? if that's the case, that would

    > >help
    > >> me with point 1
    > >>
    > >> --
    > >> Itani Mohamed
    > >>
    > >> SoftSolutions
    > >> Tel: +961.1.90.11.70 ext:141
    > >> Fax: +961.1.90.11.75
    > >> www.softsolutions.fr
    > >>
    > >>

    > >
    > >


    --
    Itani Mohamed

    SoftSolutions
    Tel: +961.1.90.11.70 ext:141
    Fax: +961.1.90.11.75
    www.softsolutions.fr



+ Reply to Thread