今天搭建ssh框架时报了这个错误,请大神分析一下,下面贴出代码,谢谢了
严重: action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
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:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" >
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/db_database07"></property>
<property name="username" value="root"></property>
<property name="password" value="111"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/lwy/dto/Userlogin.hbm.xml</value>
<value>com/lwy/dto/Specialty.hbm.xml</value></list>
</property></bean>
<!-- 定义事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <!--定义注释驱动-->
<tx:annotation-driven transaction-manager="transactionManager" /> <bean id="userLoginDao" class="com.lwy.dao.UserLoginDao">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="specialtyDao" class="com.lwy.dao.SpecialtyDao">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <bean name="/reg" class="com.lwy.action.RegAction">
<property name="userLoginDao" ref="userLginDao"></property>
<property name="specialtyDao" ref="specialtyDao"></property>
</bean>
</beans>
严重: action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
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:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" >
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/db_database07"></property>
<property name="username" value="root"></property>
<property name="password" value="111"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/lwy/dto/Userlogin.hbm.xml</value>
<value>com/lwy/dto/Specialty.hbm.xml</value></list>
</property></bean>
<!-- 定义事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <!--定义注释驱动-->
<tx:annotation-driven transaction-manager="transactionManager" /> <bean id="userLoginDao" class="com.lwy.dao.UserLoginDao">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="specialtyDao" class="com.lwy.dao.SpecialtyDao">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <bean name="/reg" class="com.lwy.action.RegAction">
<property name="userLoginDao" ref="userLginDao"></property>
<property name="specialtyDao" ref="specialtyDao"></property>
</bean>
</beans>
解决方案 »
- TimeCheck检查时间是否为有效时间
- 直接执行SQL和在JAVA程序里执行SQL区别在哪?
- 新手请教Spring事务控制XML文件配置的问题
- servlet部属到服务器上面运行一段时间后遇到问题
- axis webservice的乱码问题
- Hibernate关闭后的session可以再次打开并调用吗?
- 帮忙做个简单的例子 急
- EJB的server和client分别在两个不同的机器上,用RMI访问速度其慢,怎么提高效率阿??
- struts2项目 validation验证
- 帮忙看看这个错误什么意思?
- 关于MySQL数据库中数据类型的转换问题
- struts2使用jsonplugin 插件 对list泛型输出json的数据转义问题
建议把jsp+servlet+javabean的项目练习熟练了,再整三大框架的集成。
把上面的文字放在百度里搜一下,难道找不到答案吗?
建议别出点错就发帖问人,自己先思考,百度……