My LoginBacking
(@ManagedBean
, @ViewScoped
) has two methods: login(User)
and logout()
. Both are delegated to the @Stateless
UserLogin
service methods. From there I "save" the user in my Authorization
class (@SessionScope
). After successful login following happens:
Every time I change to another view (no matter what page) it calls the logout()
. Ill show a log:
18:44:08,266 INFO [at.mkx.app.service.UserSignup] (default task-47) Sign up: a@a.a
18:44:08,275 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (default task-47) HHH000397: Using ASTQueryTranslatorFactory
18:44:08,291 INFO [at.mkx.app.service.UserSignup] (default task-47) Signed up: id=1, email=a@a.a, password=0423fb1197c3e5ad2b21f59ce5d9c475cf56befdc9e992e4d71e06742a691a76, roles=[id=1, name=user]
18:44:39,424 INFO [at.mkx.app.service.UserLogin] (default task-51) Log in: a@a.a
18:44:39,454 INFO [at.mkx.app.service.UserLogin] (default task-51) Logged in: id=1, email=a@a.a, password=0423fb1197c3e5ad2b21f59ce5d9c475cf56befdc9e992e4d71e06742a691a76, roles=[id=1, name=user]
18:44:48,122 INFO [at.mkx.app.service.UserLogin] (default task-52) Log out!? wtf?
18:44:55,195 INFO [at.mkx.app.service.UserLogin] (default task-53) Log out!? wtf?
18:45:02,461 INFO [at.mkx.app.service.UserLogin] (default task-54) Log out!? wtf?
The last 3 lines are simple changes to other views with links. Has anyone an idea what could be wrong here?
Additional info: I removed any link(s) in the views pointing to logout()
. Furthermore I added two fake-methods in LoginBacking
and UserLogin
. As @Korgen mentioned I also log the managed bean too.
public void logout() {
log.info("LoginBacking: calls userLogin.logout()");
userLogin.logout();
}
public void foo() {
log.info("LoginBacking: Fake method");
userLogin.foo();
}
and
public void logout() {
log.info("UserLogin: Log out, No existing links in the views");
// TODO: Implement logout
}
public void foo() {
log.info("UserLogin: Fake method");
}
Log:
07:57:28,805 INFO [at.mkx.app.controller.LoginBacking] (default task-21) LoginBacking: calls userLogin.logout()
07:57:28,810 INFO [at.mkx.app.service.UserLogin] (default task-21) UserLogin: Log out, No existing links in the views
07:57:40,721 INFO [at.mkx.app.controller.LoginBacking] (default task-22) LoginBacking: calls userLogin.logout()
07:57:40,721 INFO [at.mkx.app.service.UserLogin] (default task-22) UserLogin: Log out, No existing links in the views
07:57:55,549 INFO [at.mkx.app.service.UserSignup] (default task-38) Sign up: martin@hell.zz
07:57:55,559 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (default task-38) HHH000397: Using ASTQueryTranslatorFactory
07:57:55,559 INFO [at.mkx.app.service.UserSignup] (default task-38) Signed up: id=1, email=martin@hell.zz, password=b89ae12948261984da6ad7d27e7411cb760f971927ae5e8c8b09d9e6b0554319, roles=[id=1, name=user]
07:58:07,058 INFO [at.mkx.app.controller.LoginBacking] (default task-34) LoginBacking: calls userLogin.logout()
07:58:07,067 INFO [at.mkx.app.service.UserLogin] (default task-34) UserLogin: Log out, No existing links in the views
07:58:14,344 INFO [at.mkx.app.controller.LoginBacking] (default task-43) LoginBacking: calls userLogin.logout()
07:58:14,344 INFO [at.mkx.app.service.UserLogin] (default task-43) UserLogin: Log out, No existing links in the views
07:58:40,641 INFO [at.mkx.app.service.UserLogin] (default task-51) Log in: martin@hell.com
07:58:54,600 INFO [at.mkx.app.service.UserLogin] (default task-50) Log in: martin@hell.zz
07:58:54,616 INFO [at.mkx.app.service.UserLogin] (default task-50) Logged in: id=1, email=martin@hell.zz, password=b89ae12948261984da6ad7d27e7411cb760f971927ae5e8c8b09d9e6b0554319, roles=[id=1, name=user]
07:59:13,328 INFO [at.mkx.app.controller.LoginBacking] (default task-52) LoginBacking: calls userLogin.logout()
07:59:13,329 INFO [at.mkx.app.service.UserLogin] (default task-52) UserLogin: Log out, No existing links in the views
The first logout is simply the start at index.html
. The second one the switch to the signup-view, the next two logout's is a switch to any other view and one to the login-view.
Now I am even more confused. Without any link in the views it still calls logout unintentionally. And why doesn't it call the fake-methods too?
Edit: "Solution"
Debugging didn't make me much smarter. I still could not recognize, who is calling logout()
. Removing the method just resulted in a complain from the start page index.html
that he can't find userBacking.logout()
(Note: index.html
was just one line: <h1>Leck mi am Oarsch!</h1>
). Cleaning/ Restarting wildfly10 and the app didn't help either. Finally I kicked the server completely and used a complete new and virgin instance of wildfly. And hey, suddenly it worked! I implemented the logout()
again and now it does, what it should. Still much thanks to @BalusC and @Korgen for trying to help!
So I should keep in mind for the future: Just kick the server with an angry face out of the closed window, and buy a new one!