• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

View cannot be restored exception

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using Eclipse Helios, Apache Tomcat 6.0.29 and JSF 1.2. I'm having a simple application which has a Login page, Home Page and a Logout page. Once the user logs in, a session variable is set and Home page is displayed which has a logout button. When I launch Eclipse and run the Login page and use the correct credentials, I'm able to go to the home page but when I re-run the Login page, I get an error saying "view cannot be restored".

How do I resolve this exception? PFB the exception.



Also, when I re-run the application and when the Login page comes up, I press the refresh button in the Eclipse browser and after that I dont get any such exception. If I dont refresh the login page after a re-run of the application, I get the above exception. How do I get rid of this exception?
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am not sure i understood correctly

so are you trying to say, first time you login it works fine but after you logout and login again it fails?
 
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure why you're using a session variable. If you're in JSF then your login page should call a method in your backing bean that runs the authentication, and if successful, returns a success message. Your faces-config.xml should then have a navigation rule that will direct the user to the home page when login is successful.

If you're not sure how that works then I'd recommend getting a good JSF book or find a JSF tutorial online. Navigation rules are a basic part of JSF and would save you a huge amount of effort.
 
Gvn Karthik
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Once the user logs in, he will be directed to a home page where he has to fill in a form which updates a table in the database in the back end. In that table I'm inserting the username across the user who has successfully logged in. That's why I'm using a session variable. Also, I can have tasks that can be done in a user-specific manner. If the user updates his personal details, then I can use the value of the session variable to query my database and update according to the user who has logged in.


But the exception which is coming up here is creating a problem, I mean it is trying to fetch a view which no longer exists. PFB the code in my backing bean.



Any suggestions to resolve this exception? But, here is the catch. When I run it for the second time after I launch eclipse and then refresh the login page by pressing the reload button on the eclipse browser; I don't get this exception. So, as a workaround I thought I will use javascript to automatically reload the login page as it loads. I know this is not how I should be doing but I think this might help.
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand how you're using the session variable, I just think you'd be better off making it a member of the LoginBean class.

Anyway, what is the scope of your LoginBean as configured in your faces-config.xml?
 
Gvn Karthik
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have put the LoginBean class in session scope.
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you only run this thing within Eclipse, or have you tried running it from within Tomcat separately?
 
Gvn Karthik
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't get your question. I have configured Tomcat as my server in Eclipse to run my application. And I run the application in Eclipse only.
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest deploying it to Tomcat separately, maybe on a separate instance of Tomcat on your machine, then see if you get the same behavior.

The reason is by eliminating Eclipse from the equation we can eliminate the possibility that there's an issue with different versions of .jars, etc.
 
knowledge is the difference between drudgery and strategic action -- tiny ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic