无法脱机创建bean'datasource'

时间:2017-04-25 08:45:38

标签: spring mybatis

我正在尝试在我的春季项目中使用Mybatis。

所以,我添加了下面的代码

<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-3.0.xsd
                    http://www.springframework.org/schema/jdbc  http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost/dbname"/>
    <property name="username" value="root"/>
    <property name="password" value="root"/>
</bean>
</beans>

但问题是发生了错误。 '在文件[xml文件路径]中定义名称为'dataSource'的bean创建错误' '嵌套异常是java.lang.NoClassDefFoundError'

所以我检查了这个类在java代码中是否真的不存在,但确实如此。

由于某些安全问题,我的电脑未连接到互联网。 所以我一直受到一些限制。

这是否(与互联网无关)与错误????

有关

这是我的堆栈跟踪.. 如果您将消息一直向右滚动,则会显示“NoClassDefFoundError”

enter image description here

0 个答案:

没有答案
相关问题