Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

bean not found within scope  RSS feed

 
Jay Ram
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a weird problem. I know 'bean xxx not found within scope' has occured before for a lot of people and have been answered before. But my problem is, the code is in production environment and the error has occured NOW.
It doesn't happen in the development environment. The JSP is trying to access a session variable using
<bean:define id="entity" name="legalEntity" type="java.lang.String"/>

and it gives out this error. The value was put in session by a servlet during initialization of the application. And all the JSPs access this session variable.
I am not sure if it happens all the time or sometimes. Not much details have come out yet. I see this error in the System log file..

Only thing I can thik of is that the variable is removed from session somehow. but again, it doesn't hapen in the dev environment.

Any thoughts?

Thanks in advance.

Cheers,
Jay.
 
vijaya bacina
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The value was put in session by a servlet during initialization of the application. And all the JSPs access this session variable.


How is it possible? At the time of application initialization the session will not get created . it will get created at the time of user log in.


When the session timesout or destroys the user should again log in to access the pages. This will not affect other user's session variables.
 
Jay Ram
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response Vijaya.
I am sorry that I didnt put my question properly.

It was not during the application initialization that it is put in session. It is during when the user submits the url of the first page.
e.g: myapp.com/en
myapp.com/fr

the servlet gets the url; gets the language from the url and puts it in session along with few other things..

The subsequent pages access the session variables put by the servlet in the jsp pages and this is where i get this error.

Hope it is clear now.

Can you guess what the problem would be..

Thanks for your help.

Regards,
Jay.
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if the server says it is not in session, then it must be one of two things

- the value was never put in session. Are you certain the variable was set? Maybe the user somehow sidestepped the section where you set this session variable? You never can tell what those wacky users will try next.

- the value was set, but the session is being lost. Either through timeouts, or cookies not being supported... - do a few basic tests with sessions to see if that might be the case.

Can you easily duplicate the error on production?
What would the differences be between your development and production environments?
 
Jay Ram
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response Stefan.
Looks like it is happening when the session times out..
I am trying to put a try and catch statements so that the nasty error msgs dont clog the log file.

Thanks,
Jaya.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!