Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

application scope attributes  RSS feed

 
Mark Anthony Molina
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I just want to know how application scope attributes are managed by the container. The program im working on is having a problem with session attribtues and so the only solution I thought is using the application (sevlet context) attributes. The program has 2 instances (lies on 2 servers). If I set application scope attributes at the beginning of a transaction and at some point in the transaction the session shifted from one server to another, are the attributes still available or can still be retrieved?

Many thanks...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Anthony Molina:
The program im working on is having a problem with session attribtues and so the only solution I thought is using the application (sevlet context) attributes.

A better idea would be to find out what your issues with the session are before using an inappropriate scope that could introduce even more problems.

So what issues are you having with the session? Anything similar to this?
 
Mark Anthony Molina
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The application is a payment. steps 1 and 2 retrieves user info. step 3 confirmation. upon confirmation, it will call a different program (different earfile) which will do the payment. and then it will go back to my program to update the database since the payment has been done. before the payment, i set session attributes. after the payment i retrieve them. I just received production issues that the payment was successful but the database wasnt updated. I just found out that the session doesnt exist anymore after the payment. It seldom happens actually but it did happen.

THe problem in my company is that we dont use JMS or MDB. pure jsp and servlet.. heck! anyway, i decided to use application scope attributes. i know i know it may be worse. THe reason why i may use this solution is because for every transaction, there is a unique case number generated by my program and is returned to me by the payment program after the payment. So il just use this case number as attribute name when setting them before payment and then use this id to retrieve them after the payment.

Now my problem is, if in server A I set the attributes before payment and then the payment program calls my program in the B server. I am not sure if i will successfully retrieve the attributes... hmm... sounds like its gonna fail but im hoping that it wont.. thanks
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, are you setting it in one and getting it in other? Or in same? If same find out if your session gets invalidated for some reason. If different then you should use some other way to replicate the session using some server specific stuff or use some shared stuff e.g. database.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!