dataSource配置dbcp CannotLoadBeanClassException

J2EE 码拜 9年前 (2015-04-03) 1053次浏览 0个评论
 

我的applicationContext 里面明明配置的是dbcp,tomcat启动的时候 为什么会提示找不到c3po

2015-3-18 14:21:41 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
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

而且我的项目中也添加了dbcp的jar包
dataSource配置dbcp CannotLoadBeanClassException
下面是我的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:context="http://www.springframework.org/schema/context"
     xmlns:p="http://www.springframework.org/schema/p"
     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-3.0.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-3.0.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
         http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" >
 
<context:component-scan base-package="com"/>
          
<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
    p:dataSource-ref="dataSource">
    <property name="mappingLocations">
        <list>
            <value>classpath*:/com/baobaotao/ReqType.hbm.xml</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">
                org.hibernate.dialect.MySQLDialect
            </prop>
            <prop key="hibernate.show_sql">
                true
            </prop>
        </props>
    </property>
</bean>
 
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close"
    p:url="jdbc:oracle:thin:@localhost:1521:orcl"
    p:driverClassName="oracle.jdbc.driver.OracleDriver"
    p:username="testplatform"
    p:password="testplatform"/>
     
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"
    p:sessionFactory-ref="sessionFactory"/>
     
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"
    p:sessionFactory-ref="sessionFactory"/>      
     
</beans>
dataSource配置dbcp CannotLoadBeanClassException
20分
清理一下服务器缓存,重新部署一下,再启动试试
在你的工程中搜一下com.mchange.v2.c3p0.ComboPooledDataSource 看是否存在这个class的配置
dataSource配置dbcp CannotLoadBeanClassException
引用 1 楼 magi1201 的回复:

清理一下服务器缓存,重新部署一下,再启动试试
在你的工程中搜一下com.mchange.v2.c3p0.ComboPooledDataSource 看是否存在这个class的配置

试过了没用噢。
全工程搜索了一下 也没有配置ComboPooledDataSource 的地方


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明dataSource配置dbcp CannotLoadBeanClassException
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!