spring+Mybatis 整合报错
报错信息如下:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithn...
报错信息如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/spring/app-config.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/mybatis/myBatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
app-config.xml文件内容:
<!-- Mybatis配置 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="/WEB-INF/mybatis/myBatis-config.xml" />
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
<!-- <constructor-arg index="1" value="BATCH" /> -->
</bean>
myBatis-config.xml文件内容:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC
"-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- typeAliases>
<typeAlias alias="User" type="com.ssm.entity.User"/>
</typeAliases -->
<mappers>
<mapper resource="org/geju/biz/ibatis/xml/TUSER_SqlMap.xml" />
</mappers>
</configuration>
求问题解决办法 展开
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/spring/app-config.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/mybatis/myBatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration.
app-config.xml文件内容:
<!-- Mybatis配置 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="/WEB-INF/mybatis/myBatis-config.xml" />
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
<!-- <constructor-arg index="1" value="BATCH" /> -->
</bean>
myBatis-config.xml文件内容:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC
"-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- typeAliases>
<typeAlias alias="User" type="com.ssm.entity.User"/>
</typeAliases -->
<mappers>
<mapper resource="org/geju/biz/ibatis/xml/TUSER_SqlMap.xml" />
</mappers>
</configuration>
求问题解决办法 展开
2013-04-05
展开全部
<mapper resource="org/geju/biz/ibatis/xml/TUSER_SqlMap.xml" />
里面的SQL写法有问题
加上 <![CDATA[ ]]> 试试
里面的SQL写法有问题
加上 <![CDATA[ ]]> 试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询