spring,struts,整合后整合iBATIS

来源:互联网 发布:google json插件 编辑:程序博客网 时间:2024/05/16 17:46

整合struts,spring后,整合iBATIS,遇到一些问题:

1:创建属性文件 db.properties,首次创建在src目录下,

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
           <property name="locations">  
               <list>  
                   <value>/db.properties</value>  
               </list>  
           </property>  
       </bean>  

发现无法加载,报错。

最后,将db.properties文件移至WEB-INF下,加载成功。

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
           <property name="locations">  
               <list>  
                   <value>/WEB-INF/db.properties</value>  
               </list>  
           </property>  
       </bean>  

2:

报错:org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource

解决方法:加载 commons-dbcp .jar

3:报错:java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

在MyEclipse安装文件中查找到 commons-pool.jar 加载入项目

0 0
原创粉丝点击