Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Application context data expiring  RSS feed

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

When does the data set in application context expires ?

I am observing a very unsual scenario-

1.) user logs into the application. {pages displayed use data set in application context}
2.) after few clicks on different pages, the data set in application context suddenly becomes unavailable.

data is set into the application context by a servlet in init() method during the server startup.

Kindly guide.

Thanks,
Neeraj.
 
Charles 'King
Ranch Hand
Posts: 56
Eclipse IDE Postgres Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide a sample of the code that sets the application context var(s)? If you're implementing any listeners, list those also.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Application scoped data doesn't expire.

Are you running in a clustered environment?
If so you might be hitting a node that doesn't have the variable set.
Another thing that could cause this is the application being reloaded (although, the servet init method should reset it when that happens).

I would start scouring the code to make sure something isn't removing or overwriting the attribute.
You could also create a listener to monitor when attributes are added and removed from context scope.
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContextAttributeListener.html
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using RAD 7 test environment for testing the application

thanks
Neeraj
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles 'King wrote:Please provide a sample of the code that sets the application context var(s)? If you're implementing any listeners, list those also.


I'm not sure what the value in posting the code is in this case.
The problem isn't getting the values into context scope. The problem, as stated by the OP is that the values are disappearing from scope. Without having all the code in the app (which we obviously wouldn't want posted here) we most likely won't be able to spot the problem.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there was a similar name object in the session scope. And when object in session scope was getting updated, the object in the application scope with same name was also getting update.

implementing listeners did help to debug the issue.

thanks
neeraj
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!