If you are trying to get a session, why are you casting it to HttpServletRequest?
It's like getting a round peg and trying to insert into a square hole (or vice versa, as per your preferences)
IF.... you refer to the
java documentation, in that case you will observe that the getSession Method returns an object of type HttpSession, which you are trying to cast into HttpServletRequest.
Just for the record, HttpSession and HttpServletRequest are in no way related to each other, you cannot use them as an alternate to each other, as they have totally different structure. Hence you are getting the exception.
and there are lots of things that are wrong with the piece of code and exception that you have sent over. Can't really make any head or tail out of it, unless I get to see the entire code.