The session has been lost: you have been logged off - tomcat7

I created a .war file of my application, placed it in a tomcat folder and configured it to connect to a database. Upon clicking 'startup' in bin, i'm connected to the database. However when i put my url in the browser : http://localhost:8080/TEST/ the application is not opening, instead i'm getting an alert : The session has been lost: you have been logged off
Any help on this case?

Related

CrossSecureStorage properties being cleared when application exits

I'm using Plugin.SecureStorage from https://github.com/sameerkapps/SecureStorage.
I'm trying to store data like username and password after successfully logs in the application. However, whenever I close my application, the data I saved from the CrossSecureStorage are cleared.

Redirection after login in Spring Authentication (Environment problem, Tomcat vs Jetty)

The app I am maintaining has a custom Single Sign On implementation.
After receiving a valid token (which it provided earlier and stored to db),
the app executes a CustomAuthenticationFilter successfully.
The app works fine at "Jetty" on Eclipse. After a valid url request sent, the app successfully opens the welcome page which is just after login page.
Url request:
http://99.99.99.99:8090/MyApp/j_spring_security_check?tokenId=19d79b76-0d1e-4327-871b-0e8792e03be2
But when deploy it to a "tomcat", do a valid url request, instead of opening welcome page, it stucks at login page (below)
http://99.99.99.99:8090/MyApp/login.xhtml;jsessionid=3B8C865260E86F3609F75199A23A1120
The application deployed to both, ports purely the same. No exception in logs. Even I can read successful login logs in tomcat. I can't figure out why it behaves different?

Redirected to second app but jsessionid is same as that of first app

I am working on a use-case where I have to redirect between JSF applications deployed on different servers. Kinda login app to main webapp. Initially I have deployed both of these apps on the same server and running them under same domain (localhost).
The two applications are: App A (a login portal) and App B. App A runs at root context e.g. http://localhost:8080/ and App B is at context /app e.g. http://localhost:8080/app/. When I redirect (post login) from App A to App B through a plain POST submit request, App B gets launched under the same browser tab. Upon inspecting session id cookie I see that App B, though a part of different deployment, is sharing same session id as that of App A. The cookie shows the same session id stored under path /. After launching App B, I was expecting a new session. Is it normal, do I need to create a new session explicitly? Or is it happening because I have deployed both apps war files on the same server localhost:8080?
Yes the JSESSIONID will be the same due to both apps being served from the same servletcontainer and interacting with the same browser instance. The same HTTPSession is being utilised by both apps.
For a great in depth explanation check out the reading under the HTTPSession section: How do servlets work? Instantiation, shared variables and multithreading.
Incidentally two separate browsers would access different sessions. Each one would access the server with a new session cookie and hence be given a new HTTPSession from the server. Given that you're launching both apps from within the same browser (even if using separate tab/window of same browser) the session cookie would remain the same and hence access the same HTTPSession.

Relationship Between Session, cookies and there behaviour

I am working on a project. After login i assign some value to session variable Like Session("userid")=XYZ. if i open any page inside application it will check for this value and if its not empty and has permission to access page i am allowing it.
Now if suppose i am accessing www.Domain.com/Pagename and close the tab and open the same link after copy paste it checks for session and it opens the same page which is absolutely fine.
But when i restart browser and try to open the page by link copy paste its throwing me back to login screen. Since Session is server side this should not happen. But i read on w3school that session is maintained using cookie, and cookie is lost after browser restart, so how can i maintain my session even after browser restart till it times out.It seems Both Session and cookie are contradicting each other. I didn't had this problem with similar code in asp.net application but in classic asp it doesn't seem to work.

Laravel 5 url.intended broken when session driver is set to cookie

Our Laravel 5.1 application has been using the "native" session driver setting (configured in the .env file). With it set this way, we were able to use the laravel url.intended behavior to redirect the user to the url they were attempting to access prior to being authenticated.
We had to change it to "cookie" because every time we use Amazon's Opsworks system to deploy a new build, users were logged out because their server-side session files were no longer available. Once we changed it to cookie, the users remain logged in even when we deploy a hotfix or new build.
However, with it set to cookie, the url.intended does not work at all. I tried hacking together some solution by adding a custom url intended node, but it just won't work. It seems like when the user attempts to access a url prior to being logged in, it sets the session info, but then the application redirects the user to the login page where it's getting nulled out.
I'm using Debugbar to look at the session vars and I'm going crazy. I'm already bald so I have no more hair to pull out.
Does anyone have any ideas?
We ended up setting up a Dynamo database at first and then transitioned to Redis on a common server. We have a load balancer and don't want sessions getting lost or corrupted by switching servers so all cache is now being stored in that common location.

Resources