title: Not able to load the applicationContext.xml in Spring
body: <p>Currently I facing an issue in loading the <strong>applicationContext.xml</strong>.</p>
  
  <p>I made hibernate <strong>configuration in applicationContext.xml</strong> but I don't understand what makes the problem.</p>
  
  <p>In my project i don't have Hibernate Mapping's instead I used annontation based.</p>
  
  <p><strong>Here below the issue content</strong> </p>
  
  <pre><code>INFO:   Refreshing Root WebApplicationContext: startup date [Sat Feb 07 19:41:22 IST 2015]; root of context hierarchy
  INFO:   Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
  SEVERE:   Context initialization failed
  org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
      at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5362)
      at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:743)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2278)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1924)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
      at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
      at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
  </code></pre>
  
  <p><strong>applicationContext.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!-- was: &lt;?xml version="1.0" encoding="UTF-8"?&gt; --&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:p="http://www.springframework.org/schema/p"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xmlns:util="http://www.springframework.org/schema/util"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"&gt;
  
      &lt;!--bean id="propConfigurer"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
            p:location="/WEB-INF/jdbc.properties" /&gt;
  
  &lt;bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"
      p:driverClassName="${jdbc.driverClassName}"
      p:url="${jdbc.url}"
      p:username="${jdbc.username}"
      p:password="${jdbc.password}" /--&gt;
  
     &lt;!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) --&gt;
  
     &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close"&gt;
          &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
          &lt;property name="url" value="jdbc:mysql://localhost:3306/otr" /&gt;
          &lt;property name="username" value="root" /&gt;
          &lt;property name="password" value="admin" /&gt;
     &lt;/bean&gt; 
  
     &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" /&gt;
     &lt;/bean&gt;  
  
     &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
     &lt;!-- Hibernate 4 SessionFactory Bean definition --&gt;
      &lt;bean id="hibernate4AnnotatedSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="annotatedClasses"&gt;
              &lt;list&gt;
                      &lt;value&gt;com.otr.hibernate.Employee&lt;/value&gt;
              &lt;/list&gt;            
          &lt;/property&gt;
  
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.connection.pool_size"&gt;1&lt;/prop&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;create&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
  
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>Dispatcher-Servlet.xml</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!-- was: &lt;?xml version="1.0" encoding="UTF-8"?&gt; --&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:p="http://www.springframework.org/schema/p"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:mvc="http://www.springframework.org/schema/mvc"       
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"&gt;
  
      &lt;context:component-scan base-package="com.otrrn.controller"/&gt;
      &lt;context:component-scan base-package="com.otrrn.hibernate"/&gt;
      &lt;bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/&gt;
      &lt;bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/&gt;
  
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
      &lt;!--bean id="viewResolver"
            class="org.springframework.web.servlet.view.InternalResourceViewResolver"
            p:prefix="/WEB-INF/jsp/"
            p:suffix=".jsp" / --&gt;
  
  
  
      &lt;!--
      The index controller.
      --&gt;
      &lt;!--bean name="indexController"
            class="org.springframework.web.servlet.mvc.ParameterizableViewController"
            p:viewName="index" /--&gt;
  
       &lt;bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"&gt;
          &lt;property name="definitions"&gt;
              &lt;list&gt;
                  &lt;value&gt;/WEB-INF/tiles-def/general-layout.xml&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="viewResolverTiles" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/&gt;
      &lt;/bean&gt; 
  
      &lt;mvc:annotation-driven /&gt;
  
  
      &lt;bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
        &lt;property name="prefix"&gt;
          &lt;value&gt;/WEB-INF/pages/&lt;/value&gt;
        &lt;/property&gt;
        &lt;property name="suffix"&gt;
          &lt;value&gt;.jsp&lt;/value&gt;
        &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>In the above dispatcher-servlet.xml I also have one more clarification, for controller I added component scan, is it we need for hibernate classes? if it is needed is it way to put it up?</p>
  
  <p><strong>For Controller</strong> </p>
  
  <pre><code> &lt;context:component-scan base-package="com.otrrn.controller"/&gt;
  </code></pre>
  
  <p><strong>For Hibernate</strong></p>
  
  <pre><code> &lt;context:component-scan base-package="com.otrrn.hibernate"/&gt;
  </code></pre>
  
  <p><strong>Spring Jars Lib Reference</strong></p>
  
  <p><img src="https://i.stack.imgur.com/iLlyO.png" alt="enter image description here"></p>
  
  <p>Could somebody help on this issue, thanks in advance.</p>
  
  <p>anybody faced the same issue........</p>