为了账号安全,请及时绑定邮箱和手机立即绑定

求大神解答,报错

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 16; 文档根元素 "configuration" 必须匹配 DOCTYPE 根 "mapper"。



Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 16; 文档根元素 "configuration" 必须匹配 DOCTYPE 根 "mapper"。


Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 16; 文档根元素 "configuration" 必须匹配 DOCTYPE 根 "mapper"。

spring-dao.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"

 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-2.5.xsd">

<context:property-placeholder location="classpath:jdbc.properties"></context:property-placeholder>

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">

<property name="driverClass" value="${jdbc.driverClass}"></property>

<property name="jdbcUrl" value="${jdbc.url}"></property>

<property name="user" value="${jdbc.username}"></property>

<property name="password" value="${jdbc.password}"></property>

<!-- c3p0连接池的私有属性 -->

<property name="maxPoolSize" value="30"></property>

<property name="minPoolSize" value="10"></property>

<!-- 关闭连接后不自动commit -->

<property name="autoCommitOnClose" value="false"></property>

<!-- 获取连接超时时间 -->

<property name="checkoutTimeout" value="1000"></property>

<!-- 当获取连接失败重试次数 -->

<property name="acquireRetryAttempts" value="2"></property>

</bean>


<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">

<property name="dataSource" ref="dataSource"></property>

<property name="configLocation" value="classpath:mybatis-config.xml"></property>

<property name="typeAliasesPackage" value="org.seckill.entity"></property>

<property name="mapperLocations" value="classpath:mapper/*.xml"></property>

</bean>


<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>

<property name="basePackage" value="org.seckill.dao"></property>

</bean>


</beans> 


正在回答

1 回答

<!DOCTYPE mapper

  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

去官网把这头重新换掉


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

求大神解答,报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信