本想ssm项目对easyui 树进行增删改的,结果. java ssm运行出错
控制台报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-config.xml]: Invocation of init method failed; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration.setVfsImpl(Ljava/lang/Class;)V_
报错翻译:创建在类路径资源[spring config.xml]中定义的名为“sqlSessionFactory”的bean时出错:调用init方法失败;嵌套的异常是java.lang.BootstrapMethodError:java.lang.NoSuchMethodError:org.apache.ibatis.session.Configuration.setVfsImpl(Ljava/lang/Class;)V
spring-config图片
spring-config.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: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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<!--加载 jdbc-->
<context:property-placeholder
location="classpath:jdbc.properties" ignore-unresolvable="true"/>
<!--数据源-->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<!--mybatis-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!--数据源-->
<property name="dataSource" ref="dataSource"/>
<!--sql管理文件-->
<property name="mapperLocations"
value="classpath:com/easyui/dao/*.xml"/>
<!--数据传输模板-->
<property name="typeAliasesPackage" value="com.easyui.pojo"/>
</bean>
<!--配置事务-->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!--定义声明式事务(面向切面)-->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="add*"
isolation="REPEATABLE_READ" rollback-for="Exception"/>
<tx:method name="update*"
isolation="REPEATABLE_READ" rollback-for="Exception"/>
<tx:method name="delete*"
isolation="REPEATABLE_READ" rollback-for="Exception"/>
<tx:method name="get*"
isolation="REPEATABLE_READ" read-only="true"/>
<tx:method name="*"
isolation="REPEATABLE_READ" propagation="NOT_SUPPORTED"/>
</tx:attributes>
</tx:advice>
<!--切入点-->
<aop:config>
<aop:pointcut
expression="execution(* com.easyui.service..*(..))" id="point" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="point"/>
</aop:config>
<context:component-scan base-package="com.easyui.service">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>
</context:component-scan>
<!--sql文件与dao接口的映射-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.easyui.dao"/>
</bean>
</beans>
web.xml文件,一放入配置springMVC代码运行就报这个错误。
图片:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<!--配置spring-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-config.xml</param-value>
</context-param>
<!--配置文件监听器-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--配置springMvc-->
<servlet>
<servlet-name>springMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>*.json</url-pattern>
</servlet-mapping>
</web-app>
折腾了许久都没有办法解决,有什么提议我都会尝试一遍,感激不尽《加油》。