struts2.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="struts-default.xml"/>
<constant name="struts.ui.theme" value="simple"/>
<package name="logincode" extends="struts-default">
        <action name="login" class="loginAction">
            <result name="success">oo.jsp</result>
            <result name="input">index.jsp</result>
            <result name="error">index.jsp</result>
        </action>
    </package>
</struts>applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
     <property name="configLocation">
         <value>classpath:test/spring/hibernate.cfg.xml</value>
     </property>   
</bean> 
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
     <property name="sessionFactory">
         <ref bean="sessionFactory"/>
     </property>
 </bean>
<bean id="mylogin" class="com.zoye.oa.service.Login"/>
<bean id="loginAction" class= "com.zoye.oa.action.LoginAction" scope="prototype">
     <property name="login" ref="mylogin"/>
</bean>web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="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/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
   <display-name>Struts 2.0 test xp1204</display-name>
   <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>
   <context-param>  
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext.xml
        </param-value>
    </context-param>
    
    <listener>
     <listener-class>
         org.springframework.web.context.ContextLoaderListener
     </listener-class>
 </listener>
    
 </web-app>
报错信息:
严重: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/D:/javaProgramFiles/tomcat-6.0.20/webapps/zoyeoa/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:213)
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:3800)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)

解决方案 »

  1.   

    http://blog.csdn.net/yexianyi/archive/2009/02/18/3905836.aspx
      

  2.   

    楼主把struts2.xml改成struts.xml这个才是默认的,放到工程的src文件夹下
      

  3.   

    我的就是struts.xml,放在src下面
      

  4.   

    src下有没有这个文件struts-default.xml?
      

  5.   

    没有。配置文件里本来没写<include file="struts-default.xml"/>的,报一样的错。
      

  6.   

    谢谢各位的关注。加上两个包就可以了:
    commons-io-1.3.2.jar 
    commons-fileupload-1.2.1.jar <include file="struts-default.xml"/>这行我也去掉了