title: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
body: <p>I am performing CRUD operations on MongoDB using SPRING REST api. But I am getting the following error:</p>
  <pre><code>Mar 17, 2015 2:35:40 PM org.apache.catalina.core.AprLifecycleListener init
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/avarshney/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
  Mar 17, 2015 2:35:40 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HelloSpringWithMongoDB' did not find a matching property.
  Mar 17, 2015 2:35:40 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler [&quot;http-bio-8081&quot;]
  Mar 17, 2015 2:35:40 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler [&quot;ajp-bio-8009&quot;]
  Mar 17, 2015 2:35:40 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 991 ms
  Mar 17, 2015 2:35:40 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Mar 17, 2015 2:35:40 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.34
  Mar 17, 2015 2:35:44 PM org.apache.catalina.core.ApplicationContext log
  INFO: No Spring WebApplicationInitializer types detected on classpath
  SLF4J: Failed to load class &quot;org.slf4j.impl.StaticLoggerBinder&quot;.
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  Mar 17, 2015 2:35:44 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring root WebApplicationContext
  Mar 17, 2015 2:35:44 PM org.apache.catalina.core.StandardContext listenerStart
  SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  java.lang.IllegalArgumentException
  at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)
  at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)
  at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)
  at org.springframework.core.type.classreading.SimpleMetadataReader.&lt;init&gt;(SimpleMetadataReader.java:52)
  at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
  at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
  at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
  at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:298)
  at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
  at org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
  at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:230)
  at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:153)
  at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130)
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285)
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  
  Mar 17, 2015 2:35:44 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Error listenerStart
  Mar 17, 2015 2:35:44 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [/HelloSpringWithMongoDB] startup failed due to previous errors
  Mar 17, 2015 2:35:44 PM org.apache.catalina.core.ApplicationContext log
  INFO: Closing Spring root WebApplicationContext
  Mar 17, 2015 2:35:44 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler [&quot;http-bio-8081&quot;]
  Mar 17, 2015 2:35:44 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler [&quot;ajp-bio-8009&quot;]
  Mar 17, 2015 2:35:44 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 4267 ms
  </code></pre>
  <p>Here's my <strong>pom.xml</strong></p>
  <pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.manishchhabra.blog&lt;/groupId&gt;
  &lt;artifactId&gt;HelloSpringWithMongoDB&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;HelloSpringWithMongoDB Maven Webapp&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;version&gt;4.1.5.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;4.1.5.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
          &lt;artifactId&gt;spring-data-mongodb&lt;/artifactId&gt;
          &lt;version&gt;1.6.2.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;jstl&lt;/groupId&gt;
          &lt;artifactId&gt;jstl&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;3.8.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
      &lt;finalName&gt;HelloSpringWithMongoDB&lt;/finalName&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  <p>Heres my <strong>web.xml</strong></p>
  <pre><code>&lt;web-app xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee 
       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;
  version=&quot;2.5&quot;&gt;
  
  &lt;display-name&gt;Spring With MongoDB Web Application&lt;/display-name&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/dispatcher-servlet.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/dispatcher-servlet.xml
      &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  <p>Here's my <strong>dispatcher-servelet.xml</strong> (WEB_INF/jsp/dispatcher-servelet.xml)</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
  xmlns:p=&quot;http://www.springframework.org/schema/p&quot;
  xsi:schemaLocation=&quot;
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context-3.2.xsd&quot;&gt;
  
  &lt;context:component-scan base-package=&quot;com.manishchhabra.blog&quot; /&gt;
  
  &lt;!-- Factory bean that creates the Mongo instance --&gt;
  &lt;bean id=&quot;mongo&quot; class=&quot;org.springframework.data.mongodb.core.MongoFactoryBean&quot;&gt;
      &lt;property name=&quot;host&quot; value=&quot;localhost&quot; /&gt;
  &lt;/bean&gt;
  
  &lt;!-- MongoTemplate for connecting and querying the documents in the database --&gt;
  &lt;bean id=&quot;mongoTemplate&quot; class=&quot;org.springframework.data.mongodb.core.MongoTemplate&quot;&gt;
      &lt;constructor-arg name=&quot;mongo&quot; ref=&quot;mongo&quot; /&gt;
      &lt;constructor-arg name=&quot;databaseName&quot; value=&quot;test&quot; /&gt;
  &lt;/bean&gt;
  
  &lt;!-- Use this post processor to translate any MongoExceptions thrown in 
      @Repository annotated classes --&gt;
  &lt;bean
      class=&quot;org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor&quot; /&gt;
  
  
  &lt;bean id=&quot;jspViewResolver&quot;
      class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;
      p:prefix=&quot;/WEB-INF/jsp/&quot; p:suffix=&quot;.jsp&quot; /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  <p>I am using Tomcat v7.0 to run this on local server and I have added the necessary jars in WEB_INF/lib in the deployment assembly. Please advise as to what to do in order to run the code.</p>
  <p><strong>EDIT:</strong> Edited the stacktrace to show all the messages.</p>
  <p><strong>EDIT 2 :</strong> Edited the pom.xml to change Spring to 4.1.5 release</p>