title: BeanFactory not initialized or already closed - call 'refresh' before
body: <p>here is my error: </p>
  
  <p>I am getting this error , can any one help me on this.</p>
  
  <pre><code>&gt; SEVERE: Exception sending context initialized event to listener
  &gt; instance of class
  &gt; org.springframework.web.context.ContextLoaderListener
  &gt; java.lang.NoSuchMethodError:
  &gt; org.springframework.beans.factory.xml.XmlBeanDefinitionReader.setEnvironment(Lorg/springframework/core/env/Environment;)V
  &gt;   at
  &gt; org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87)
  &gt;   at
  &gt; org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
  &gt;   at
  &gt; org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
  &gt;   at
  &gt; org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
  &gt;   at
  &gt; org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
  &gt;   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)    at
  &gt; java.util.concurrent.FutureTask.run(Unknown Source)   at
  &gt; java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
  &gt;   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  &gt;   at java.lang.Thread.run(Unknown Source) Nov 21, 2013 12:54:38 PM
  &gt; org.apache.catalina.core.StandardContext startInternal SEVERE: Error
  &gt; listenerStart Nov 21, 2013 12:54:38 PM
  &gt; org.apache.catalina.core.StandardContext startInternal SEVERE: Context
  &gt; [/FLPalette] startup failed due to previous errors Nov 21, 2013
  &gt; 12:54:38 PM org.apache.catalina.core.ApplicationContext log INFO:
  &gt; Closing Spring root WebApplicationContext Nov 21, 2013 12:54:38 PM
  &gt; org.apache.catalina.core.StandardContext listenerStop SEVERE:
  &gt; Exception sending context destroyed event to listener instance of
  &gt; class org.springframework.web.context.ContextLoaderListener
  &gt; java.lang.IllegalStateException: BeanFactory not initialized or
  &gt; already closed - call 'refresh' before accessing beans via the
  &gt; ApplicationContext    at
  &gt; org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:172)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1066)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1040)
  &gt;   at
  &gt; org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988)
  &gt;   at
  &gt; org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556)
  &gt;   at
  &gt; org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4763)
  &gt;   at
  &gt; org.apache.catalina.core.StandardContext$4.run(StandardContext.java:5472)
  &gt;   at java.lang.Thread.run(Unknown Source)     at
  &gt; org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5481)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:225)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
  &gt;   at
  &gt; org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
  &gt;   at
  &gt; org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
  &gt;   at
  &gt; org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
  &gt;   at
  &gt; org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
  &gt;   at
  &gt; org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
  &gt;   at
  &gt; org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
  &gt;   at
  &gt; org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
  &gt;   at org.apache.catalina.startup.Catalina.start(Catalina.java:620)    at
  &gt; sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
  &gt; sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)   at
  &gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   at
  &gt; java.lang.reflect.Method.invoke(Unknown Source)   at
  &gt; org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)   at
  &gt; org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431) Nov 21,
  &gt; 2013 12:54:38 PM org.apache.coyote.AbstractProtocol start INFO:
  &gt; Starting ProtocolHandler ["http-bio-8080"] Nov 21, 2013 12:54:38 PM
  &gt; org.apache.coyote.AbstractProtocol start INFO: Starting
  &gt; ProtocolHandler ["ajp-bio-8009"] Nov 21, 2013 12:54:38 PM
  &gt; org.apache.catalina.startup.Catalina start
  </code></pre>
  
  <p>pom.xml :</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.paypal.palette&lt;/groupId&gt;
    &lt;artifactId&gt;FLPalette&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
     &lt;name&gt;FLPalette&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
    &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;mysql&lt;/groupId&gt;
      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
      &lt;version&gt;5.1.5&lt;/version&gt;
  &lt;/dependency&gt;
         &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;  
  
    &lt;dependency&gt;
      &lt;groupId&gt;wsdl4j&lt;/groupId&gt;
      &lt;artifactId&gt;wsdl4j&lt;/artifactId&gt;
      &lt;version&gt;1.6.3&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.8.1&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.14&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&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.1.2&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;taglibs&lt;/groupId&gt;
          &lt;artifactId&gt;standard&lt;/artifactId&gt;
          &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&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;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-ldap&lt;/artifactId&gt;
          &lt;version&gt;3.1.1.RELEASE&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.jcraft&lt;/groupId&gt;
          &lt;artifactId&gt;jsch&lt;/artifactId&gt;
          &lt;version&gt;0.1.50&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
      &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
      &lt;artifactId&gt;spring-security-taglibs&lt;/artifactId&gt;
      &lt;version&gt;3.1.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;org.json&lt;/groupId&gt;
      &lt;artifactId&gt;json&lt;/artifactId&gt;
      &lt;version&gt;20090211&lt;/version&gt;
      &lt;/dependency&gt;   
      &lt;dependency&gt;
     &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
     &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
     &lt;version&gt;1.2.1&lt;/version&gt; 
      &lt;/dependency&gt;   
       &lt;dependency&gt;
        &lt;groupId&gt;commons-io&lt;/groupId&gt;
        &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
        &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;           
    &lt;/dependencies&gt;
    &lt;properties&gt;
          &lt;org.springframework.version&gt;3.0.2.RELEASE&lt;/org.springframework.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
    &lt;build&gt;
      &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;   
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&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;plugin&gt;
             &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;           
         &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;  
  &lt;/project&gt;
  </code></pre>