Session migration and replication

Hi All,
I am having a hard time in configuring my application for HTTP session migration. Our weblogic server consists of two managed servers running in same cluster. Each server has an Ehcache that stores some information of user with key as session ID and value as info object. In case, if a server needs restart, we would want to take this updated info Object from cache residing on server being restarted to another managed server within the same cluster.
I browsed through many documentations online. Most of them explained about session replication but not migration. so I followed replication (I don't want a real time sync up of HTTP session. I want it to migrate if something goes wrong with one of the managed server).
However, I could not achieve this task after following the steps to configure this feature. I would appreciate a lot if someone can help me figuring out the issue here.
Here is what I did.
1) Weblogic.xml
     <session-descriptor>
<persistent-store-type>replicated_if_clustered</persistent-store-type>
</session-descriptor>
2) An implementation class of HttpSessionActivationListener, HttpSessionListener, HttSessionAttributeListener:
public void sessionDidActivate(HttpSessionEvent sessionEvent) {
// NEVER GETS CALLED
over here i would check if session has any attribute with name 'CACHE_ELEMENT'. If yes, then it is a migration case for current managed server
          Log.info(UserCacheMigrationListener.class, "inside sessionDidActivate");//
public void sessionWillPassivate(HttpSessionEvent sessionEvent) {
// NEVER GETS CALLED
Over here I would set attribute 'CACHE_ELEMENT' so that it is available for target managed server when it's sessionDidActivate is called
          Log.info(UserCacheMigrationListener.class, "inside sessionWillPassivate");
public void sessionCreated(HttpSessionEvent sessionEvent) {
THIS GETS CALLED! and I set the following attribute
sessionEvent.getHttpSession().setAttribute(UserCacheMigrationListener.class.getName(), this);
public void sessionDestroyed(HttpSessionEvent arg0) {
THIS GETS CALLED!
public void valueBound(HttpSessionBindingEvent arg0) {
THIS GETS CALLED! WHICH MEANS THAT I WAS ABLE TO setAttribute this class's instance in sessionCreatedMethod
In the above code, the setAttribute method used inside the sessionCreated(..) method successfully sets the attribute to this session. This is apparent because valueBound(..) method is called when session is created. But why does it not call the sessionWillActivate method???
3.) An entry in web.xml for this listener.
     <listener>
          <listener-class>com.xyz.UserCacheMigrationListener</listener-class>
     </listener>
4) from weblogic config.xml. I am copying all meaning stuffs from config.xml to describe as much as I can.
<server>
<name>AdminServer</name>
<ssl>
<enabled>false</enabled>
</ssl>
<listen-address>localhost</listen-address>
<network-access-point>
<name>AdminChannel</name>
<protocol>t3</protocol>
<listen-address>localhost</listen-address>
<http-enabled-for-this-protocol>true</http-enabled-for-this-protocol>
<tunneling-enabled>false</tunneling-enabled>
<outbound-enabled>false</outbound-enabled>
<enabled>true</enabled>
<two-way-ssl-enabled>false</two-way-ssl-enabled>
<client-certificate-enforced>false</client-certificate-enforced>
</network-access-point>
<data-source>
<rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
</data-source>
</server>
<server>
<name>Node1</name>
<ssl>
<enabled>false</enabled>
</ssl>
<machine>DevMachine</machine>
<listen-port>7002</listen-port>
<cluster>DevCluster</cluster>
<replication-group>devGroup1</replication-group>
<preferred-secondary-group>devGroup2</preferred-secondary-group>
<web-server>
<keep-alive-secs>500</keep-alive-secs>
<post-timeout-secs>120</post-timeout-secs>
</web-server>
<listen-address>localhost</listen-address>
<jta-migratable-target>
<user-preferred-server>Node1</user-preferred-server>
<cluster>DevCluster</cluster>
</jta-migratable-target>
<data-source>
<rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
</data-source>
</server>
<server>
<name>Node2</name>
<ssl>
<enabled>false</enabled>
</ssl>
<machine>DevMachine</machine>
<listen-port>7003</listen-port>
<cluster>DevCluster</cluster>
<replication-group>devGroup2</replication-group>
<preferred-secondary-group>devGroup1</preferred-secondary-group>
<listen-address>localhost</listen-address>
<network-access-point>
<name>Node2Channel</name>
<protocol>t3</protocol>
<listen-address>localhost</listen-address>
<http-enabled-for-this-protocol>true</http-enabled-for-this-protocol>
<tunneling-enabled>true</tunneling-enabled>
<outbound-enabled>false</outbound-enabled>
<enabled>true</enabled>
<two-way-ssl-enabled>false</two-way-ssl-enabled>
<client-certificate-enforced>false</client-certificate-enforced>
</network-access-point>
<jta-migratable-target>
<user-preferred-server>Node2</user-preferred-server>
<cluster>DevCluster</cluster>
</jta-migratable-target>
<data-source>
<rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
</data-source>
</server>
<cluster>
<name>DevCluster</name>
<cluster-messaging-mode>unicast</cluster-messaging-mode>
</cluster>
<machine>
<name>DevMachine</name>
<node-manager>
<nm-type>Plain</nm-type>
</node-manager>
</machine>
<migratable-target>
<name>Node1 (migratable)</name>
<notes>This is a system generated default migratable target for a server. Do not delete manually.</notes>
<user-preferred-server>Node1</user-preferred-server>
<cluster>DevCluster</cluster>
</migratable-target>
<migratable-target>
<name>Node2 (migratable)</name>
<notes>This is a system generated default migratable target for a server. Do not delete manually.</notes>
<user-preferred-server>Node2</user-preferred-server>
<cluster>DevCluster</cluster>
</migratable-target>
------------------------------------------------------------------------------------------------------------------

Hi,
So you want to migrate your server to server.
Here are the following links which help you.
http://docs.oracle.com/cd/E15051_01/wls/docs103/cluster/migration.html
http://www.oracle.com/technetwork/middleware/weblogic/messaging/wlasm-1853193.pdf
let me know the status if you need any further help on this issue.
Regards,
Kal

Similar Messages

  • Session in-memory replication problem

    Hi,
              I am running into some cluster HttpSession replication problems. Here is
              the scenario where replication fails (all servers mentioned here are a
              part of a cluster).
              1a - 2 Weblogic servers (A&B) are running - no users logged in,
              2a - user logs in and a new session in server A is created.
              3a - after several interactions, server A is killed.
              4a - after user makes susequent request, Weblogic correctly fails over
              to server B
              Problem: Not entire session data is replicated. The authentication info
              seems to
              be replicated correctly but there are some collections in the session of
              server A
              that did not make it to the session in server B.
              The interesting part is this: If there is only one server A running to
              begin with and a user
              interacts with it for a while and only then server B is started, when
              after server B starts up
              server A dies - the entire session (which is exactly the same as in the
              failing scenario) is
              corretly replicated in B, including collections that were missing in the
              failing scenario.
              How can this be possible ????
              Thanks for any info on this one - it really puzzles me.
              Andrew
              

    Yes, you are on the right track. Everytime you modify the object you should call
              putValue. We will make it more clear in the docs.
              - Prasad
              Andrzej Porebski wrote:
              > Everything is Serilizable. I get no exceptions. I did however read some old
              > posts regarding
              > session replication and I hope I found an answer. It basically seems to boil
              > down to what
              > triggers session sync-up between servers. In my case , I store an object into
              > session and
              > later on manipulate that object directly wihotu session involvment and the
              > results of those manipulations
              > are not replicated - no wonder if HttpSession's putValue method is the only
              > trigger.
              > Am i on the right track here?
              >
              > -Andrew
              >
              > Prasad Peddada wrote:
              >
              > > Do you have non serializable data by any chance?
              > >
              > > - Prasad
              > >
              > > Andrzej Porebski wrote:
              > >
              > > > Hi,
              > > > I am running into some cluster HttpSession replication problems. Here is
              > > > the scenario where replication fails (all servers mentioned here are a
              > > > part of a cluster).
              > > > 1a - 2 Weblogic servers (A&B) are running - no users logged in,
              > > > 2a - user logs in and a new session in server A is created.
              > > > 3a - after several interactions, server A is killed.
              > > > 4a - after user makes susequent request, Weblogic correctly fails over
              > > > to server B
              > > >
              > > > Problem: Not entire session data is replicated. The authentication info
              > > > seems to
              > > > be replicated correctly but there are some collections in the session of
              > > > server A
              > > > that did not make it to the session in server B.
              > > >
              > > > The interesting part is this: If there is only one server A running to
              > > > begin with and a user
              > > > interacts with it for a while and only then server B is started, when
              > > > after server B starts up
              > > > server A dies - the entire session (which is exactly the same as in the
              > > > failing scenario) is
              > > > corretly replicated in B, including collections that were missing in the
              > > > failing scenario.
              > > >
              > > > How can this be possible ????
              > > >
              > > > Thanks for any info on this one - it really puzzles me.
              > > >
              > > > Andrew
              > >
              > > --
              > > Cheers
              > >
              > > - Prasad
              >
              > --
              > -------------------------------------------------------------
              > Andrzej Porebski
              > Sailfish Systems, Ltd. Phone 1 + (212) 607-3061
              > 44 Wall Street, 17th floor Fax: 1 + (212) 607-3075
              > New York, NY 10005
              > -------------------------------------------------------------
              

  • Session Failover and Clustering

              Let's say that we have two WebServers (NES) with the weblogic plugin (say WS1 and WS2) and a cluster with two WebLogicCommerce AppServers (say AS1 and AS2). Let's assume that each WebServer and AppServer runs on its own machine (total: 4 machines). Now, let's assume that the WebServer "obj.conf" files (on both WS1 and WS2) are setup so that they point to the servers in the cluster (WebLogicCluster="AS1:7601,AS2:7601").
              When a new request comes in to one of the WebServers (say WS1), the plugin will route it to one of the AppServers using Round-Robin (say AS1). A session will now be initiated in AS1 and it sends a response back to the client.
              Question 1: How does the other proxy in WS2 know that all future requests for this client need to be forwarded to AS1?
              Question 2: For failover, does the cluster automatically replicate the session state existing in AS1 onto AS2 before sending the response (does AS2 automatically become the secondary)?
              Now let's assume that AS1 crashes/dies. When the next request from the client comes to WS1 or WS2, they will forward it to AS1 (assuming that WS2 knows about the client session in AS1) . Since AS1 has crashed, will the client eventually get a timeout error message?
              Question 3: To ensure that the session failover happens so that AS2 gets the request instead (becomes the primary), do we need to setup a WebLogic Proxy Server? If so, why can't the plugins for NES provide the failover themselves?
              Thank you very much for your help!
              Giri
              

              Thank you very much for your responses. It has been very helpful and I am clear on the session/clustering stuff. I have new questions on EJB and clustering which I will post as a separate thread.
              Giri
              "Jason Rosenberg" <[email protected]> wrote:
              >And also, if the browser has cookies disabled, it is important for
              >the app server to embed the WebLogicSession info via url rewriting,
              >otherwise the proxy or NES will not be able to route the session
              >properly.
              >
              >So, in all http responses, be sure to pass the url string through
              >response.encodeURL(). This will do the right thing depending
              >on whether cookies are enabled or not.
              >
              >I've just only recently figured this out. Haven't actually tried it
              >all out yet, so forgive me if it is not quite this simple, but this
              >seems to be the gist of it...
              >
              >Jason
              >
              >
              >"Justin James" <[email protected]> wrote in message news:[email protected]...
              >>
              >> Giri,
              >>
              >> I'm not a weblogic representative, but I tried to replicate this proxing service inside a load balancing switch(BigIP) and I
              >discovered a few things. The weblogic server sets a cookie (WebLogicSession)that the webserver plugin uses to manage the proxying.
              >The cookie (found in the HTTP header information) contains encoded information about the primary and secondary application servers
              >that the session is bound too. Any web server can read the cookie to determine how to dispatch the request to the primary server.
              >If the primary server does not respond, the request is forwarded to the secondary server by the plugin. Regardless of cluster size,
              >the session is replicated to only one other server.
              >>
              >> <[email protected]> wrote:
              >> >Giri Alwar wrote:
              >> >
              >> >> I need a couple of clarifications. First with regard to Question 1, I understand that plugins provide load balancing and
              >failover but what I really was asking is how the plugin in WS2 knows that a session for the client has been initiated in AS1 as a
              >result of WS1 sending the initial request to AS1. If WS2 gets a future request from the client, it needs to know this to send the
              >request to AS1. Does the plugin talk to the cluster to find out if there is a primary and who it is?
              >> >>
              >> >
              >> >> I should have clarified that my other questions pertain to in-memory replication. If I do not persist the session in a database
              >then does the client get an error message (timeout) when AS1 goes down (assuming we use NES with the WebLogic plugin)?
              >> >
              >> >Plugins' know how to route requests based on cookies. If it can't reach the primary server it will automatically try secondary.
              >In your case it doesn't matter if it reaches to proxy 1 or proxy 2, it is still the same.
              >> >
              >> >- Prasad
              >> >
              >> >> To prevent this error message and achieve failover, do I need to use WebLogic as the proxy server? If so, why isn't the NES
              >plugin doing this?
              >> >
              >> >> Thanks.
              >> >> Giri
              >> >>
              >> >> Prasad Peddada <[email protected]> wrote:
              >> >> >Giri Alwar wrote:
              >> >> >
              >> >> >> Let's say that we have two WebServers (NES) with the weblogic plugin (say WS1 and WS2) and a cluster with two
              >WebLogicCommerce AppServers (say AS1 and AS2). Let's assume that each WebServer and AppServer runs on its own machine (total: 4
              >machines). Now, let's assume that the WebServer "obj.conf" files (on both WS1 and WS2) are setup so that they point to the servers
              >in the cluster (WebLogicCluster="AS1:7601,AS2:7601").
              >> >> >>
              >> >> >> When a new request comes in to one of the WebServers (say WS1), the plugin will route it to one of the AppServers using
              >Round-Robin (say AS1). A session will now be initiated in AS1 and it sends a response back to the client.
              >> >> >>
              >> >> >> Question 1: How does the other proxy in WS2 know that all future requests for this client need to be forwarded to AS1?
              >> >> >
              >> >> > Plugin takes care of load balancing and failover, it is all transparent to the client.
              >> >> >
              >> >> >
              >> >> >> Question 2: For failover, does the cluster automatically replicate the session state existing in AS1 onto AS2 before sending
              >the response (does AS2 automatically become the secondary)?
              >> >> >
              >> >> > If you have only two yes it is automatically your secondary. Yes, replication is synchronous.
              >> >> >
              >> >> >>
              >> >> >> Now let's assume that AS1 crashes/dies. When the next request from the client comes to WS1 or WS2, they will forward it to
              >AS1 (assuming that WS2 knows about the client session in AS1) . Since AS1 has crashed, will the client eventually get a timeout
              >error message?
              >> >> >
              >> >> > If you are using some kind of persistence then you will be able to retrieve the session information and since the server
              >is not available the request will automatically failover.
              >> >> >
              >> >> >> Question 3: To ensure that the session failover happens so that AS2 gets the request instead (becomes the primary), do we
              >need to setup a WebLogic Proxy Server? If so, why can't the plugins for NES provide the failover themselves?
              >> >> >
              >> >> > No, you need only one. Either NES or weblogic proxy.
              >> >> >
              >> >> >
              >> >> >> Thank you very much for your help!
              >> >> >> Giri
              >> >> >
              >> >> >- Prasad
              >> >> >
              >> >
              >>
              >
              >
              

  • Migration and then Activation

    Hi Gurus,
    I have 2 questions.
    I'm working on BI 7 and I have migrated a DataSource from 3.5 into BI 7.
    After migration, it's showing unequal sign (M version is different from A version).
    When I checked the BI Content I found the DataSource(InfoSource) was already installed.
    1.    Now I am thinking of Activating it again but Please let me know how important it is to re-activate
           it. Is there any issue while reActivating BI Content ?
    2.    Anothe problem is - few Gurus suggested me to use Standard InfoCube related to Standard
           DataSource instead of creating a new one. My question is how do I do this:
           Well, I have done this in this way,
           I created a new InfoCube (under my InfoArea) copying the Standard one.
           Have I done the right thing ?
    Points will be rewarded.
    Thanks,
    Akash.

    Hi,
       1. Theres is no issue reactivating Bi content. After migration or replication, generally the objects go into inactive state..so u need to reactivate them if you want to make use of it.
       2. You could have directly activated the Standard Infocube from Business content if it wasnt being used and hasnt been installed. However if the standard is already in use or you dont wont to tamper with it...then its fine if you've copied it.
    Assign points if useful
    Regards.

  • Cannot perform a live migration while replication is enabled

    I have two Server 2012 machines that I am running hyper-v on (just testing for now).  I can right click on a virtual machine and move it (live migration) to the other server with no issues.  I can also enable replication on the VM and that
    appears to work properly.  However, if I have replication enabled on a VM I am unable to perform a live migration.  I receive an error that says the VM already exists on the destination server (because of the replication). 
    Is there any way to perform a live migration while replication is enabled?

    I can't think of a reason why you would want to anywhere else but a test environment. Replication's intended use is DR across a WAN between two physical location (there are others, but this is primarily why it was created). If Office1 burns down, you can
    boot your Replica at Office2. Live Migration is for local HA. If Server1 has a hardware failure, Live Migrate to Server2.
    If everyone could simply Live Migrate over their WAN link between offices, Replication would be redundant. But getting a fast enough WAN link for this is extremely expensive, so Microsoft created Replication for high latency, low bandwidth WAN connections.
    TL;DR, Replication and Live Migration are mutually exclusive in almost all environments. It's not even that they *can't* work together, it's just that there's no point in making them work together because they're for different use cases.

  • "Session migration in progress"

    Pop up window on OLT shows the following message:
    FormsConnectionException occured. Connection Error:Session migration in progress
    It works fine in OpenScript, and that it only fails in OLT after X number of iterations. for example it was running only 57 users and after the 57 users together complete 140 iterations with 18 of them failing due to "Session Migration in Progress Error", and one it fail for any user all the rest of iteration will fail for this user.
    Cst applied the solution in the Doc ID 1135962.1 with no success .. also verified the Jsession id and it is getting co-related correctly in the script. ... any suggestions?

    sayantan_chak wrote:
    Hi,
    Our performance testing team is getting below error from OATS in R12 system:
    "Connection Error: Session migration in progress".
    This R12 installation is a shared APPL_TOP with one DB server, two internal forms/web servers, two CM servers and two external form servers in DMZ. All the servers have SSL setup. We have two F5's one for internal load balancing and one for external reverse proxy.
    Can anyone help on the issue? The OATS script is running fine in other single tier installations without SSL or shared APPL_TOP.
    Thanks
    Sayantan
    Please see:
    Troubleshooting OpenScript Errors for EBS/Forms Scripts (Doc ID 1135962.1)
    Forms/EBS Script Recording fails on OpenScript 12.1.0.2 (Doc ID 1501857.1)
    Thanks,
    Hussein

  • Afaria Database on SQL Anywhere 12 and Replication

    Hi,
    I have Afaria Farm and I Use SQL Anywhere 12 as database server.
    I want to replicate this database to another SQL Anywhere 12 Server.
    Which one is good way to replication
    And can I have some documentation that tells this step by step?
    I am not a DB admin.

    Hello Tevfik,
    I think we need to understand your requirements a little more: why are you interested in SQL Anywhere replication and what are your plans for it?
    If you're looking for an always-available SQL Anywhere database for Afaria, there is high-availability (database mirroring). This will allow you to maintain two database server partners (with a third arbiter), where the primary has read/write capabilities and the mirror partner is read-only. There is a tutorial here in the documentation.
    If you're looking for a reporting server to do read-only queries for reporting, there is read-only scale out (copy nodes). The tutorial can be found here.
    Are you trying to keep a backup copy of your database via replication? If so, you may want to consider live backups (see the wiki), or just regular backups (also see the wiki). Regular backups should still be used in conjunction with any of the high-availability scenarios described above.
    If you're really looking for data movement, particularly to multiple database nodes, there is synchronization to other enterprise databases (including SQL Anywhere, but this also includes HANA, ASE, IQ, etc.) with MobiLink and replication to other SQL Anywhere databases, via SQL Remote. MobiLink uses a session-based HTTP or TCP/IP connection as a transport, while SQL Remote can use offline FILE, FTP, SMTP, and online HTTP as a transport.
    You may read elsewhere that historically SQL Anywhere can also be used with SQL Remote for Adaptive Server Enterprise (ASE) or Replication Server for replication, but both of these methods have been deprecated and removed in current versions and are not supported by development.
    Regards,
    Jeff Albion
    SAP Active Global Support

  • Session timeout and custom sso

    Hi,
    can anyone tell me how the session and idle timeout feature in Apex exactly works?
    I built several applications in a workspace and do a sso authorization by setting a common cookie name. In addition to that i set the values for session length and idle timeout and assumed that the session length would be synchronized over all applications. But this doesn't seem to work. For instance, i set the idle timeout to 10 minutes in all applications and now i work for 15 minutes continously in application A and after that i switch over to application B (using the same session id!), the session is already expired in B.
    Is this behavior correct? And, if yes, how can i set up a synchronization over all applications?
    Jens

    Anyone?

  • What is the difference between Session timeout and Short Session timeout Under Excel Service Application -- session management?

    Under Excel Service Application --> session management; what is the difference between Session timeout and Short Session timeout?

    Any call made from the API will automatically be set to the “Session Timeout” period, no matter
    what. Calls made from EWA (Excel Web Access) will get the “Short Session Timeout” period assigned to it initially.
    Short Session Timeout and Session Timeout in Excel Services
    Short Session Timeout and Session Timeout in Excel Services - Part 2
    Sessions and session time-outs in Excel Services
    above links are from old version but still applies to all.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Database Mirroring and Replication in SQL Server 2008 R2

    I have configured the mirroring and replication between 4 servers (A,B,C,D).i.e, Mirroring between A to B and C to D, Replication between A and C. The configuration was a success and I am able test the replication(B to C) when I have failed over the mirroring
    dbs(A to B). The replication works fine after the mirroring fail over but I am not able to check its status in the Replication monitor. When I am having any insert in a table which is replicated in B, it is reflected back to C..it means the replication is
    working fine.
    Any thought on how I can view the status of replication from mirrored server. I tried adding the publisher in the monitor, but no luck. If I check the snapshot agent status, it says could not retrieve the info, same with the log reader agent status.
    Any suggestions on this please.
    Thanks, Siri

    For example in your case...
    Server A is principal and Server B is Mirror with either Manual or Automatic Failover.
    Server A is replicated to Server B ( publisher & B is subscriber )
    In Server A Database named Test_Mirror_Replication is configured for both mirroring and Replication.
    Now you have failed over your Database 'Test_Mirror_Replication' from Server A to Server B.
    After the Failover Server A will act as Mirror for DB 'Test_Mirror_Replication' & Server B will act as Principal for DB 'Test_Mirror_Replication'
    Hope my understanding is correct ?
    If yes then have you tried monitoring the replication after registering in other instance with current principal database sql instance name ? I mean current Publisher database name sql instance ? not your old sql instance name which was before the mirroring
    role change or failover...
    Hope you are trying with mirror database server name ?
    Raju Rasagounder MSSQL DBA

  • How to open a URL without session ID and reuse the current browser session?

    Hi All,
    I have a question about HTMLDB 2.0
    How to open a URL without session ID and reuse the current browser session?
    That was the behaviour in HTMLDB 1.6 ...
    My usecase for this is the following:
    We have written an issue tracking application, which sends e-mail to the interested users, when something happens.
    In these email we've put a link to some page, with some parameters in the URL.
    The idea is for the user to be easy to click on the hyperlink and to see the details of the ticket.
    When the user clicks on such a link he is directed to a login screen (page 101) and he enters his Username and password, and is then forwarded to the details for the ticket.
    Then he receives another email (e.g. for another ticked). He clicks on the link and :
    a) in HTMLDB 1.6 he goes to the details as he didn't close his browser and session is remembered
    b) in HTMLDB 2.0 he is prompted to enter username, password with the username populated
    Please tell me how can I achieve the same behaviour in HTMLDB2.0 as it was in HTMLDB 1.6.
    I understand this change is somehow security related, althogh I don't understand how. If you can explain this either I would be very happy?
    Best regards,
    Mihail Daskalov

    Mihail - I detailed a couple of approaches here: Re: Application Link
    Scott

  • Session variable and initialization block issues

    We are using OBIEE 10.1.3.3 and utilizes built in security features. (No LDAP or other single sign on). The user or group names are not stored in any external table. I have a need to supplement Group info of the user to the usage tracking we implemented recently as the NQ_LOGIN_GROUP.RESP column contains username instead of group name. So I created a session variable and associated with a new initialization block and also had a junk default value set to the variable. In the initialization block, I wrote the following query and as a result it inserted correct values into the table when the TEST button was clicked from the initialization block form.
    insert into stra_login_data (username, groupname, login_time) values ('VALUEOF(NQ_SESSION.USER)', 'VALUEOF(NQ_SESSION.GROUP)', SYSDATE)
    My intention is to make this execute whenever any user logs on. The nqserver.log reports the following error and it doesn?t insert values into the table.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.USER, has no value definition.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.GROUP, has no value definition.
    When I changed the insert statement as below, this does get populated whenever someone logs in. But I need the values of GROUP associated with the user as defined in the repository.
    insert into stra_login_data (username, groupname, login_time) values ('TEST_USER', TEST_GROUP', SYSDATE)
    Could someone help me out! As I mentioned above, I need the GROUP info into the usage tracking. So, if there is another successful approach, could you please share?
    Thank you
    Amin

    Hi Amin,
    See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3376946&#3376946]. You can't use the GROUP session variable in an Init Block unless it has been seeded from an Init Block first. There isn't an easy solution for what you want, but here are some options:
    1) Create a copy of your User => Groups assignments in your RPD in an table so you can use it in your Usage Tracking Subject Area. But this means you will have to replicate the changes in two places so it's not a good solution.
    2) As the GROUP session variable is populated when you login you could theoretically use it a Dashboard and pass it a parameter to write the value to the database. But as I am not sure how can you make fire only once when the user logins it sounds like a bad idea.
    3) Move your User => Groups assignments from your RPD to a DB table. Use OBIEE Write Back or something like Oracle APEX to maintain them.
    I think 3) is the best solution to be honest.

  • Session variable and Tracking in Header file

    Is there a way for me to keep track of the session and use a variable in my Header to pass around for this?
    I have a login.jsp, validate_login.jsp and other jsp's that have the same header file. Instead of me using the same code in all of the jsp's I thought it would be easier to put it in the header Please look at the example code below:
    // validate_login.jsp is passed username and password from the login.jsp.
    // validate_login then calls the logIn method in my Session class.
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="uom.edu.rd.session.Session"%>
    <html>
    <head><title>Validate Login</title></head>
    <body>
    <jsp:include page="header.jsp" />
    <%
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        this_session.logIn(username, password);   
        boolean b = this_session.getLoggedIn();
    %>
    ==================================================================
    // The logIn method in Session class
    public void logIn(String userName, String password) {
             Connection con = null;
             Statement stmt = null;
             ResultSet rs = null;
             try{
                con = db.getConnection();
                 stmt = con.createStatement();
                 String sql = "SELECT * FROM RD_USER WHERE USER_NAME = '" + userName +"' AND USER_PASSWORD = '" + password + "'";
                  rs = stmt.executeQuery(sql);
                  if(rs.next()){
                       loggedIn=true;
                  }else{
                       loggedIn=false;
             catch(Exception e){
                  // If something goes wrong, make sure
                  // the user is not logged in.
                  loggedIn=false;
              }finally{
                  try{
                       rs.close();
                       stmt.close();
                       con.close();
              }catch(Exception e){
         * Log the user out.
        public void logOut() {
             loggedIn = false;
         * Get the login status.
         * @return boolean
        public boolean getLoggedIn() {
             return loggedIn;
    ==================================================================
    // and this is part of my header.jsp
    <%@page import="uom.edu.rd.session.Session"%>
    <%
      Session this_session = Session.findSession(request);
      if ( this_session==null ) {
          /* Now, instead of redirecting, create a new Session
           * object and initialize it.
          this_session = new Session();
          this_session.makeSession(request);
          this_session.createQueryBuilder(config);     
    %>
    // This is the part I would like to pass around
    <!-- Session logged_in = new Session(); -->
    <%   
        boolean loggedIn = this_session.getLoggedIn();    
            if (loggedIn == false)
            { %>
                <A STYLE="color:#FFFFFF;text-decoration:none;" HREF="./login.jsp"><FONT COLOR="#FFFFFF">LOG IN</font></a>  <FONT COLOR="#FFFFFF"></font>
        <%  } else { %>
                <A STYLE="color:#FFFFFF;text-decoration:none;" HREF="./logout.jsp"><FONT COLOR="#FFFFFF">LOG OUT</font></a>  <FONT COLOR="#FFFFFF"></font>
         <% }
    %>
    // so if you are logged in  then you are able to view certain things on the jsp's if you are not logged in
    // then of course you cannot. I want to pass around this loggedIn variable to all the jsp's
    // after it checks  loggIn Status for each page I have tried running this but I keep getting an error: cannot resolve symbol this_session

    Use <%@ include file="header.jsp" %> instead

  • Session Login and Logout in jsp page

    hi
    i am developing jsp page
    i completed except logout.jsp page
    my login page is in Jsp format and then business Logic in servlet and then get method & set method in bean.java
    i have login and then it sucess page there i have singout button
    if i sign out it should go to login page
    how to do
    how to make session invalidate
    how to get session id
    i have one more doubt i should check session invalidate each jsp page
    regarding session login and logout in jsp
    if anybody knows please give me a piece of code regarding login and logout
    Regards
    Akshatha

    This is part of your filter class now you need login.jsp page
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="Stylesheet" type="text/css" href="/PAS/css/site.css"/>
        <title>Automation System | Login Page</title>
    </head>
    <body>
    <div align="center">
        <h1>Photint Automation System</h1>
    </div>
    <br/><br/><br/>
    <center>
        <table border="1" cellpadding="0" cellspacing="0" width="40%" bgcolor="FFFFFFFF">
            <thead>
                <tr>
                    <th align="left" height="30"> <h3>    Login</h3></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <div align="center">
                            <form name="LOGIN" action="/PAS/LoginServlet" method="POST">
                                <table border="0">
                                    <tbody>
                                        <tr>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">User Name : </td>
                                            <td align="left"  height="30"><input type="text" name="USERNAME" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">Password : </td>
                                            <td align="left"  height="30"><input type="password" name="PASSWORD" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="50"></td>
                                            <td height="50"></td>
                                            <td align="center" height="50"><input type="submit" value="Login" name="Login" />  <input type="reset" value="Reset" name="Reset" /></td>
                                            <td height="50"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </center>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    <br/><br/><br/>
    <center>Copyright &copy; 2009 Photint FZ LLC</center>
    <center>Powered by Ali Jamali</center>
    <center>Version : 1.0</center>
    </body>
    </html>And you need loginServlet.java
    package com.ali.util.filter;
    import com.ali.entity.user.UserEntity;
    import com.ali.util.HibernateUtil;
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class LoginServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String username = request.getParameter("USERNAME");
            String password = request.getParameter("PASSWORD");
            if (username == null || username.length() == 0) {
                System.err.println(" Username textfeild is empty ..... !");
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            if (UserRegistry.isUserLoggedIn(username)) {
                System.out.printf("User [%s] is already logged in. \n", username);
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            UserEntity user = null;
            try {
                user = (UserEntity) HibernateUtil.load(UserEntity.class, username);
                if (user == null || !user.getPassword().equals(password)) {
                    RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                    dispatcher.forward(request, response);
                    System.err.println(" Password or username is not valid ..... !");
                    return;
            } catch (Exception e) {
                e.printStackTrace();
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            HttpSession session = request.getSession();
            System.err.println(request.getRemoteAddr());
            session.setAttribute("username", user.getFirstName());
            session.setAttribute("userType", user.isAdmin());
            UserRegistry.logInUser(username);
            response.sendRedirect("/PAS/index.jsp");
    }finally is you need to just one user can be online at time or need to know how many user & who is online you should at this class also
    package com.ali.util.filter;
    import java.util.ArrayList;
    import java.util.List;
    public class UserRegistry {
        private static final List loggedInUsers = new ArrayList();
        public static void logInUser(String username) {
            loggedInUsers.add(username);
        public static void logoutUser(String username) {
            if (isUserLoggedIn(username)) {
                loggedInUsers.remove(username);
        public static boolean isUserLoggedIn(String username) {
            return loggedInUsers.contains(username);
    }If you have any more Q. or any comment , Most welcome
    Thanks
    Ali Jamali

  • Session pooling and statement handles

    Hi there,
    I have a large multi-threaded application (perhaps >100 threads). Each thread is continuously processing events (very high volumes) which involves some manipulation and some database operations (from a fixed set of possible operations).
    I am using session pooling but what I want to know is, Should I:
    (a) Prepare my fixed set of statement handles up front at program start-up when I'm creating the session pool and then reuse the statement handles in each event processing thread (also, is this thread safe ? even if it is, all threads would be contending on the same statement handles)
    or
    (b) Prepare the statement handle for each event which presumably will exploit the statement cache on the session pool. This would also mean not having statement handles shared between threads thus removing any thread contention issues.
    I think (b) is the option for me, but does anyone have any thoughts ?

    With a), one would think it's OK, but I would hate to find out that it's not thread safe by accident.
    But anyway, with b) the cost of allocating private statement handles in each thread seems very low. The memory required for the statement handle plus its bind and define handles could very well be below 8k per statement. If you've got say, 5 statements * 100 threads, you're only looking at around 4MB overall.
    Finally, you might want to make sure that the session pool statement cache is working by checking the values for 'executions' and 'parse_calls' in V$SQL for your statements.

Maybe you are looking for

  • MacBook can no longer connect to the Internet in anyway

    I have a 2007 MacBook which has always connected to the Internet with no problems until the other day I turned it on and could not connect to the Internet. I have tried Wi-fi and Ethernet and it says it is connected yet when I open my browser (I have

  • IWeb and iPhone icons

    I have created a iphone friendly website with iWeb, and want to make an icon so i can use the add bookmark to home screen feature to my iphone. How would i do this with iWeb? Or is it not available? Thank You

  • Template Save As help.  Please! ack!

    When I apply a template to a page and go to File Save or Ctrl S it directs me to the Templates Box and asks me the name that I want to call the template. I don't want it to be a template, I just want my plain old .cfm file back! So I try File Save As

  • Recovery Disk Charge

    Hi, finally got round to calling the IBM service line today to request a recovery disk and was disgusted to find that the out of warranty charge for a replacement disk is £40.  My thinkpad X32 was purchased off the great online auction site at a pric

  • What's the best way to clone to another Mac with the same system id so I do not have to re-authorize plugins/programs?

    I was told in a different thread that cloning is my answer for my problem.  Once learning that, I checked around and saw people suggesting Super Duper over the Disk Utility option, saying that I will not have to re-authorize my programs.  That it's t