I am getting the following error while trying to run a Spring project
HTTP Status 500 - java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
Inspite of adding the listner on to my web.xml
. I am still getting this error. Below is the listener I have added to my web.xml :
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/HelloWebRedirect-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Can someone help me out in this regard?
Hi @user2681868 I was also facing the same problem here are the steps you should follow.
1) in web.xml define this
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2) create a applicationContext.xml in web-inf with this content
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
</beans>
Try like this
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With