I am using Spring annotations. I am getting exception while accessing login page : java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
I have written <context:component-scan base-package="XXX.XXX"/> in dispatcher-servlet.xml file.
Please help me in resolving this issue :
Thanks .
Waswani Naresh
Ranch Hand
Joined: May 01, 2008
Posts: 66
posted
0
For adding ContextLoaderListener, you have to include the below tag in the web.xml.
Servlet spec plays a major role in such type of errors. ContextLoaderListener works with all the continers supporting Servlet 2.4 spec and some servers supporting Servlet 2.3 spec.
Which Web container or application server (along with version) are you using ?
Please go through the below link to find more information.
to web.xml.. Not required though, but you can check with this once
Gireesh Mulage
Ranch Hand
Joined: Mar 08, 2010
Posts: 44
posted
0
Thank you very much for your help .
My problem solved by adding @RequestMapping("login.do") annotation before start of class .
Also , added @RequestMapping(method=RequestMethod.GET) before start of both methods and loginForm() is renamed to showLoginForm()... Thats it!
Gireesh Mulage
Ranch Hand
Joined: Mar 08, 2010
Posts: 44
posted
0
sorry for onSubmit() we need to use RequestMethod.POST and for showLoginForm we need to use RequestMethod.GET bcz that method will be loaded before loading the login.jsp.