问题描述
严重:**********FATALERRORSTARTINGUPSTRUTS-SPRINGINTEGRATION**********LooksliketheSpringlistenerwasnotconfiguredforyourwebapp!NothingwillworkuntilWebApplicationContextUtilsreturnsavalidApplicationContext.Youmightneedtoaddthefollowingtoweb.xml:<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>2010-5-1712:06:01com.opensymphony.xwork2.util.logging.commons.CommonsLoggererror严重:Dispatcherinitializationfailedjava.lang.NullPointerExceptionatcom.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:490)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:446)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)atorg.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)atcom.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)atorg.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)atorg.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)atorg.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)atorg.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)atorg.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)atorg.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)atorg.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4222)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:927)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:890)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:736)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:448)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:700)atorg.apache.catalina.startup.Catalina.start(Catalina.java:552)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)2010-5-1712:06:01org.apache.catalina.core.StandardContextfilterStart严重:Exceptionstartingfilterstruts2Class:com.opensymphony.xwork2.spring.SpringObjectFactoryFile:SpringObjectFactory.javaMethod:getClassInstanceLine:209-com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1atorg.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)atorg.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)atorg.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)atorg.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)atorg.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)atorg.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4222)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:927)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:890)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:736)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:448)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:700)atorg.apache.catalina.startup.Catalina.start(Catalina.java:552)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)Causedby:java.lang.NullPointerExceptionatcom.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:490)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:446)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)atorg.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)atcom.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)atorg.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)atorg.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)...28more2010-5-1712:06:01org.apache.catalina.core.StandardContextstart严重:ErrorfilterStart
解决方案
解决方案二:
struts.xml<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.0//EN""http://struts.apache.org/dtds/struts-2.0.dtd"><struts><packagename="default"extends="struts-default,jasperreports-default"><actionname="PDF"class="com.sterning.JasperAction"><resultname="success"type="jasper"><paramname="location">/jasper/compiled_jasper_template.jasper</param><paramname="dataSource">myList</param><paramname="format">PDF</param></result></action><actionname="HTML"class="com.sterning.JasperAction"><resultname="success"type="jasper"><paramname="location">/jasper/compiled_jasper_template.jasper</param><paramname="dataSource">myList</param><paramname="format">HTML</param></result></action><actionname="XML"class="com.sterning.JasperAction"><resultname="success"type="jasper"><paramname="location">/jasper/compiled_jasper_template.jasper</param><paramname="dataSource">myList</param><paramname="format">XML</param></result></action><actionname="CSV"class="com.sterning.JasperAction"><resultname="success"type="jasper"><paramname="location">/jasper/compiled_jasper_template.jasper</param><paramname="dataSource">myList</param><paramname="format">CSV</param></result></action><actionname="XLS"class="com.sterning.JasperAction"><resultname="success"type="jasper"><paramname="location">/jasper/compiled_jasper_template.jasper</param><paramname="dataSource">myList</param><paramname="format">XLS</param></result></action></package></struts>
解决方案三:
查struts配置文件
解决方案四:
web.xml<?xmlversion="1.0"encoding="UTF-8"?><web-appversion="2.4"xmlns="http://java.sun.com/xml/ns/j2ee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><!--TheWelcomeFileList--><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>
解决方案五:
就是spring的上下文监听没配啊
解决方案六:
没用到spring啊
解决方案七:
引用5楼the9thyz0的回复:
没用到spring啊
<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>那这个是什么?
解决方案八:
spring的配置呢Youmightneedtoaddthefollowingtoweb.xml:<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
解决方案九:
错误信息都告诉你了你就把监听复制上去啊把下面这段话复制到你的web.xml文件中<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>