小弟用的是struts-2.0.14,配置开发环境时,已经导入了所有的jar包,web.xml是这样配置的

           <filter>
<filter-name>Struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>Struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

可开启tomcat的时候,却报如下的错误
2010-1-2 0:12:18 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2010-1-2 0:12:20 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2010-1-2 0:12:20 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts.xml]
2010-1-2 0:12:20 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM locale
2010-1-2 0:12:21 org.apache.struts2.spring.StrutsSpringObjectFactory <init>
信息: Initializing Struts-Spring integration...
2010-1-2 0:12:22 org.apache.struts2.spring.StrutsSpringObjectFactory <init>
严重: ********** 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: 
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
2010-1-2 0:12:23 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter Struts2
java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:189)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:479)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:450)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:407)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:239)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:152)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
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.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206)
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)
2010-1-2 0:12:23 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-1-2 0:12:23 org.apache.catalina.core.StandardContext start
严重: Context [/struts2Demo] startup failed due to previous errors
都是按照教程来的,却怎么也搞不对

解决方案 »

  1.   

    叫你把这段加到web.xml里面去
    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:
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener </listener-class>
        </listener> 
      

  2.   

    回复2楼,难道jar包导多了也不行啊
    回复3楼,我加了那一段的结果也还是不行的,但那一段我也根本用不着啊
      

  3.   

    xwork-2.0.3
    struts2-core-2.0.8
    freeer-2.3.8
    commons-logging-1.0.4
    antlr-2.7.6
    试试,不行的话。
    commons-fileupload-1.2.1再导进去。
      

  4.   

    回复nihaozhangchao
    我的确是jar包导多了,110long说的也对
    但现在有个问题,为什么我每次启动tomcat都特别慢呢,要30多S,我的天哦,受不了
      

  5.   


    看下tomcat的webapps下面是不是有war包?有就删掉。另外是否发布了很多项目?没用的也可以删掉了。
      

  6.   

    解释下原因:
    jar包中,可能包含配置文件,可能会覆盖一些原始的配置,但是你又没有满足这些配置需要的环境,就会报错
      

  7.   

    把这两个包加进去试试
    commons-io-1.3.2.jar
    commons-fileupload-1.2.1.jar
      

  8.   

    <constant name="struts.objectFactory" value="spring" />