首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

org.springframework.beans.factory.CannotLoadBeanClassException:

2011-12-11 
●●●在线等 spring提示和我配置不符,我该怎么办?●●●Java code?xml version1.0 encodingUTF-8?bean

●●●在线等 spring提示和我配置不符,我该怎么办?●●●

Java code
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">    <bean id="dataSource"        [color=#FF0000]class="org.apache.commons.dbcp.BasicDataSource">[/color]        <property name="driverClassName"            value="com.mysql.jdbc.Driver">        </property>        <property name="url"            value="jdbc:mysql://localhost:3306/mytest">        </property>        <property name="username" value="root"></property>        <property name="password" value=""></property>    </bean>    <!--  一配置id 为dataSource 的bean,该bean 是个数据源实例一<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/mytest</value>      </property>      <property name="username">      <value>root</value>      </property>      <property name="password">      <value></value>      </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.SQLServerDialect                </prop>            </props>        </property>        <property name="mappingResources">            <list>                <value>                    com/soulab/mybbs/beans/MybbsForums.hbm.xml                </value>                <value>                    com/soulab/mybbs/beans/MybbsGroups.hbm.xml                </value>                <value>com/soulab/mybbs/beans/MybbsPosts.hbm.xml</value>                <value>                    com/soulab/mybbs/beans/MybbsThreads.hbm.xml                </value>                <value>com/soulab/mybbs/beans/MybbsUsers.hbm.xml</value>                <value>                    com/soulab/mybbs/beans/ForumViewIndex.hbm.xml                </value>                <value>                    com/soulab/mybbs/beans/PostViewViewthread.hbm.xml                </value>                <value>                    com/soulab/mybbs/beans/ThreadViewForumdisplay.hbm.xml                </value>            </list>        </property>    </bean>    <bean id="mybbsForumsDAO"        class="com.soulab.mybbs.daos.MybbsForumsDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="mybbsGroupsDAO"        class="com.soulab.mybbs.daos.MybbsGroupsDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="mybbsPostsDAO"        class="com.soulab.mybbs.daos.MybbsPostsDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="mybbsThreadsDAO"        class="com.soulab.mybbs.daos.MybbsThreadsDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="mybbsUsersDAO"        class="com.soulab.mybbs.daos.MybbsUsersDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="forumViewIndexDAO"        class="com.soulab.mybbs.daos.ForumViewIndexDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="postViewViewthreadDAO"        class="com.soulab.mybbs.daos.PostViewViewthreadDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean id="threadViewForumdisplayDAO"        class="com.soulab.mybbs.daos.ThreadViewForumdisplayDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean>    <bean name="/getIndexView"        class="com.soulab.mybbs.struts.action.GetIndexViewAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>        <property name="td">            <ref local="mybbsThreadsDAO" />        </property>    </bean>    <bean name="/getForumdisplayView"        class="com.soulab.mybbs.struts.action.GetForumdisplayViewAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>        <property name="td">            <ref local="mybbsThreadsDAO" />        </property>    </bean>    <bean name="/getViewthreadView"        class="com.soulab.mybbs.struts.action.GetViewthreadViewAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>        <property name="td">            <ref local="mybbsThreadsDAO" />        </property>        <property name="pd">            <ref local="mybbsPostsDAO" />        </property>        <property name="gd">            <ref local="mybbsGroupsDAO" />        </property>    </bean>    <bean name="/checkSameName"        class="com.soulab.mybbs.struts.action.CheckSameNameAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>    </bean>    <bean name="/regist"        class="com.soulab.mybbs.struts.action.RegistAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>        <property name="gd">            <ref local="mybbsGroupsDAO" />        </property>    </bean>    <bean name="/login"        class="com.soulab.mybbs.struts.action.LoginAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>    </bean>    <bean name="/newThread"        class="com.soulab.mybbs.struts.action.NewThreadAction">        <property name="td">            <ref local="mybbsThreadsDAO" />        </property>    </bean>    <bean name="/clickThread"        class="com.soulab.mybbs.struts.action.ClickThreadAction">        <property name="td">            <ref local="mybbsThreadsDAO" />        </property>    </bean>    <bean name="/newPost"        class="com.soulab.mybbs.struts.action.NewPostAction">        <property name="pd">            <ref local="mybbsPostsDAO" />        </property>    </bean>    <bean name="/delpost"        class="com.soulab.mybbs.struts.action.DelpostAction">        <property name="pd">            <ref local="mybbsPostsDAO" />        </property>    </bean>    <bean name="/searchUser"        class="com.soulab.mybbs.struts.action.SearchUserAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>    </bean>    <bean name="/getGroups"        class="com.soulab.mybbs.struts.action.GetGroupsAction">        <property name="gd">            <ref local="mybbsGroupsDAO" />        </property>    </bean>    <bean name="/updateUserInfo"        class="com.soulab.mybbs.struts.action.UpdateUserInfoAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>    </bean>    <bean name="/addForum"        class="com.soulab.mybbs.struts.action.AddForumAction">        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>    </bean>    <bean name="/delForum"        class="com.soulab.mybbs.struts.action.DelForumAction">        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>        <property name="pd">            <ref local="mybbsPostsDAO" />        </property>    </bean>    <bean name="/getTargetForum"        class="com.soulab.mybbs.struts.action.GetTargetForumAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>        <property name="td">            <ref local="mybbsThreadsDAO" />        </property>    </bean>    <bean name="/updateForum"        class="com.soulab.mybbs.struts.action.UpdateForumAction">        <property name="ud">            <ref local="mybbsUsersDAO" />        </property>        <property name="fd">            <ref local="mybbsForumsDAO" />        </property>    </bean></beans> 


011/09/29 9:44:43 org.apache.catalina.core.ApplicationContext log
情報: Initializing WebApplicationContext for Struts ActionServlet 'action', module ''
2011/09/29 9:44:44 org.apache.catalina.core.ApplicationContext log
致命的: action: null
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
Caused by: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSourceat org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
。。。。。。。。

[解决办法]
应该是没引入这个包
com.springsource.com.mchange.v2.c3p0-0.9.1.2.jar
[解决办法]
有没有导入连接池的JAR包啊。好像是缺少了C3P0的JAR包。
[解决办法]
楼主你这配置文件是复制的吧,不然不会这么多错误的,我粗略看下
首先:<ref bean="dataSource" />这句话错了吧
还有你用的是不是tomcat
[解决办法]
java.lang.ClassNotFoundException:com.mchange.v2.c3p0.ComboPooledDataSource

缺少了C3P0的JAR包
[解决办法]
重新配置


[解决办法]
java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource

热点排行