Buggy code:
@ Controller public class MainController { @ Autowired private GameListService gameListService ; @ Autowired private ResultService r ; @ Autowired private LoginService loginService ; @ Autowired private PersonService personService ; @ RequestMapping ( "index" ) public String showIndex ( Model model ) { } @ RequestMapping ( "*" ) public String person ( @ ModelAttribute Login login , @ ModelAttribute ( "sendNewPassword" ) SendNewPassword sendNewPassword ) { } @ RequestMapping ( "about" ) public String showAbout ( Model model ) { } @ RequestMapping ( "choosegame" ) public ModelAndView chooseGame ( ModelAndView mav ) { } @ RequestMapping ( value = "choosegame" , method = RequestMethod . POST ) public ModelAndView chooseGame ( ModelAndView mav , @ RequestParam ( "gameid" ) String id ) { } @ RequestMapping ( "highscore" ) public ModelAndView chooseGameHighscore ( ModelAndView mav ) { } @ RequestMapping ( value = "login" , method = RequestMethod . POST ) public ModelAndView logIn ( ModelAndView mav , HttpSession session , @ Valid @ ModelAttribute ( "login" ) Login login , BindingResult error , Model modell , @ ModelAttribute ( "sendNewPassword" ) SendNewPassword sendNewPassword ) { System . out . println ( "333333333" ) ; if ( error . hasErrors ( ) ) { System . out . println ( "<seq2seq4repair_space>Passord<seq2seq4repair_space>tomt,<seq2seq4repair_space>eller<seq2seq4repair_space>ikke<seq2seq4repair_space>gyldig<seq2seq4repair_space>Email-adresse.<seq2seq4repair_space>" ) ; mav . setViewName ( "firstLogin" ) ; return mav ; } if ( loginService . compareInformation ( login ) ) { Person inloggedPerson = personService . getPerson ( login . getEmail ( ) ) ; <START_BUG> User user = new User ( inloggedPerson . getEmail ( ) , inloggedPerson . getFname ( ) , inloggedPerson . getLname ( ) ) ; <END_BUG> user . setInLogged ( true ) ; session . setAttribute ( "user" , user ) ; mav . setViewName ( "chooseGameHighscore" ) ; System . out . println ( "Highscore<seq2seq4repair_space>er<seq2seq4repair_space>satt<seq2seq4repair_space>**********************************" ) ; return chooseGameHighscore ( mav ) ; } else { System . out . println ( "Innlogging<seq2seq4repair_space>feilet.<seq2seq4repair_space>" ) ; modell . addAttribute ( "wrongPassword" , "Feil<seq2seq4repair_space>brukernavn//passord.<seq2seq4repair_space>Prøv<seq2seq4repair_space>på<seq2seq4repair_space>nytt" ) ; mav . setViewName ( "firstLogin" ) ; return mav ; } } @ RequestMapping ( value = "choosegameHighscore" , method = RequestMethod . POST ) public ModelAndView chooseGameHighscore ( ModelAndView mav , @ RequestParam ( "gameid" ) String id ) { } @ RequestMapping ( "loginAsGuest" ) public ModelAndView loginAsGuestFunction ( ModelAndView mav , HttpSession session ) { } @ RequestMapping ( "completionlist" ) public ModelAndView chooseGameCompletionlist ( ModelAndView mav , HttpSession session ) { } @ RequestMapping ( value = "choosegameCompletionlist" , method = RequestMethod . POST ) public ModelAndView chooseGameCompletionlist ( ModelAndView mav , @ RequestParam ( "gameid" ) String id , HttpSession session ) { } }

Fix:
User user = new User ( inloggedPerson . getEmail ( ) , inloggedPerson . getFname ( ) , inloggedPerson . getLname ( ) , inloggedPerson . getTeacher ( ) ) ;