首页 新闻 会员 周边

mybatis报错

0
悬赏园豆:10 [已关闭问题] 关闭于 2022-09-22 09:37

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enterpriseOperationController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enterpriseOperationServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enterpriseServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'enterpriseMainMapper' defined in file [D:\code\sundry\enterpriseDataCollection\target\classes\com\beijing\enterprise\mapper\EnterpriseMainMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\code\sundry\enterpriseDataCollection\target\classes\mapper\EnterpriseInfoBackusMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 23; columnNumber: 80; 元素内容必须由格式正确的字符数据或标记组成。

实在是找不出什么问题了

这个是有mapper.xml文件就会报错,删了mapper.xml文件就不报错了,那位大佬知道怎么解决

以下是依赖文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>

</parent>
<groupId>com.example</groupId>
<artifactId>enterpriseDataCollection</artifactId>
<version>0.0.1</version>
<name>enterpriseDataCollection</name>
<description>enterpriseDataCollection project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</dependency>


<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>

<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
<version>8.2.0</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>

<!--
工具包
-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.onpositive.aml</groupId>
<artifactId>org.aml.apimodel</artifactId>
<version>0.0.10</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.10.0</version>
</dependency>


<!--给邮箱发送信息的依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>2.5.6</version>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.8</version>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>15.0</version>
<scope>compile</scope>
</dependency>


</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>

</build>

</project>

以下是配置文件
server:
port: 8081

#数据库4要素配置
spring:
datasource:
driver-class-name: com.kingbase8.Driver
url: jdbc:kingbase8://*********?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: *****
password: **********

mail:
host: smtp.qq.com
default-encoding: utf-8
#(填写自己的qq邮箱就可以)
username: *******@qq.com
#(这个填写自己qq邮箱的授权码就可以,就是一个程序的访问密码!)
password: ********
#(qq邮箱服务的端口号,465 or 587都可以)
port: 465
properties:
mail:
smtp:
#(这个是日志,可以在控制台看一些日志)
debug: true
# 协议
protocol: smtps
thymeleaf:
cache: true
encoding: UTF-8
mode: html


http:
#创建连接的最长时间
connectTimeout: 30000
#从连接池中获取到连接的最长时间
connectionRequestTimeout: 300000
#并发数
defaultMaxPerRoute: 20
#最大连接数
maxTotal: 100
#数据传输的最长时间
socketTimeout: 300000
#提交请求前测试连接是否可用
staleConnectionCheckEnabled: true


# 日志配置
# 指定具体包的日志级别
logging:
level:
com:
lagou: debug
#日志输出配置
config: classpath:logback.xml
file:
path: ./
mybatis:
mapper-locations: classpath:mapper/*.xml





sunny-JJ的主页 sunny-JJ | 初学一级 | 园豆:-3
提问于:2022-09-21 11:58

主要原因是jdbc包多放了,本来是jdbc想改到kingbase来着,结果依赖冲突,没有删除完所导致的,

sunny-JJ 1年前
< >
分享
所有回答(2)
0

<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>

这个依赖和kingbase冲突了

sunny-JJ | 园豆:-3 (初学一级) | 2022-09-22 09:37
1

那不是告诉你Mapper映射文件里面有符号错误,解析不出来吗

没有阑尾 | 园豆:190 (初学一级) | 2022-10-12 16:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册