严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iUserDaoImpl' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required
Caused by: java.lang.IllegalArgumentException: Property 'dataSource' is required<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=Text"/>
<property name="username" value="sa"/>
<property name="password" value="2010"/>
</bean> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"  > 
<property name="configLocation" value="/WEB-INF/classes/com/founder/config/sqlmap/SqlMapConfig.xml"> 
</property>
</bean>
<bean id="iUserDaoImpl" class="com.founder.dao.impl.IUserDAOImpl">
<property name="sqlMapClient" ref="sqlMapClient"/>
</bean>
<bean name="IndexAction" class="com.founder.action.IndexAction">
<property name="iUserDAO" ref="iUserDaoImpl"/>
</bean>
</beans>

解决方案 »

  1.   

    <bean id="iUserDaoImpl" class="com.founder.dao.impl.IUserDAOImpl">
    貌似少了<property name="dataSource" ref="dataSource" />加上试试 看...
      

  2.   

    你这个问题很怪啊,是应用程序读取applicationContext.xml的时候没有找到bean iUserDaoImpl的指向。你配置文件<bean name="IndexAction" class="com.founder.action.IndexAction">
    <property name="iUserDAO" ref="iUserDaoImpl"/>
    </bean>
    这个地方有问题,你在Action中注入了一个DAO对象,然后这个DAO的实现类是IMPL,你这里配置有问题所有找不到。我一般的做法是Action注DAO,然后DAO里面注IMPL,而不是直接指向,貌似是不识别的。你试试。
    但是你后面又报了一个IllegalArgumentException,这个就很诡异了,具体的你还得看看代码。
      

  3.   

    <bean id="iUserDaoImpl" class="com.founder.dao.impl.IUserDAOImpl">
    <property name="sqlMapClient" ref="sqlMapClient"/>
    </bean>
    添加对datasource的引用