• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

application scope attributes

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic