title: Fatal error setting up Struts-Spring Integration from xwork-core-2.2.1.jar
body: <p>I am configuring Struts2 and Hibernate frameworks, and I am getting an error from <strong>xwork-core-2.2.1.jar</strong>:</p>
  
  <pre><code>9:08:22,406  INFO StrutsSpringObjectFactory:42 - Initializing Struts-Spring integration...
  19:08:22,421 FATAL StrutsSpringObjectFactory:89 - ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
  Looks like the Spring listener was not configured for your web app! 
  Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
  You might need to add the following to web.xml: 
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  19:08:22,453 DEBUG XmlConfigurationProvider:68 - Loaded [BUILDER] {PackageConfig Name:struts-default namespace: parents:[]}
  19:08:22,468 ERROR Dispatcher:38 - Dispatcher initialization failed
  java.lang.NullPointerException
      at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:530)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:501)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:457)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275)
      at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
      at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
      at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
      at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
      at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:108)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)
      at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
      at java.lang.Thread.run(Unknown Source)
  Dec 8, 2010 7:08:22 PM org.apache.catalina.core.StandardContext filterStart
  SEVERE: Exception starting filter sample-filter
  Class: com.opensymphony.xwork2.spring.SpringObjectFactory
  File: SpringObjectFactory.java
  Method: getClassInstance
  Line: 220 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1
      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)
      at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
      at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:108)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)
      at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
      at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.NullPointerException
      at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:530)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:501)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:457)
      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275)
      at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
      at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
      at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
      ... 16 more
  Dec 8, 2010 7:08:22 PM org.apache.catalina.core.StandardContext start
  SEVERE: Error filterStart
  Dec 8, 2010 7:08:22 PM org.apache.catalina.core.StandardContext start
  SEVERE: Context [/hiber] startup failed due to previous errors
  </code></pre>
  
  <p>My WEB.XML is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" 
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  
   &lt;filter&gt;
    &lt;filter-name&gt;sample-filter&lt;/filter-name&gt;
    &lt;filter-class&gt;
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    &lt;/filter-class&gt;
    &lt;/filter&gt;
  
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;sample-filter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I don't know what the problem is and I don't want to have to configure Spring. What should I do?</p>