spring入门 错误
1:org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.mchange.v2.c3p0.ComboPooledDataSource] for bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource
问题描述:在
applicationContext.xml配置文件里用c3p0配置数据源
<beans>
?<!-- 定义数据源Bean,使用C3P0数据源实现 -->
?<bean id="dataSource" destroy-method="close">
??<!-- 指定连接数据库的驱动 -->
??<property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
??<!-- 指定连接数据库的URL -->
??<property name="jdbcUrl" value="jdbc:sqlserver://localhost;DatabaseName=HotelDB;SelectMethod=cursor"/>
??<!-- 指定连接数据库的用户名 -->
??<property name="user" value="sa"/>
??<!-- 指定连接数据库的密码 -->
??<property name="password" value="sa"/>
??<!-- 指定连接数据库连接池的最大连接数 -->
??<property name="maxPoolSize" value="40"/>
??<!-- 指定连接数据库连接池的最小连接数 -->
??<property name="minPoolSize" value="1"/>
??<!-- 指定连接数据库连接池的初始化连接数 -->
??<property name="initialPoolSize" value="1"/>
??<!-- 指定连接数据库连接池的连接的最大空闲时间 -->
??<property name="maxIdleTime" value="20"/>
?</bean>
原因没有导入c3p0-0.9.0.4.jar包
?
2:org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
?
问题描述:在
applicationContext.xml配置文件却少spring.jar包
?
?
3:
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
却dom4j包
?