报错1:SpringBoot找不到bean

Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

缺少注解 @SpringBootApplication


报错2:Maven Process terminated

Maven 编译遇到 Process terminated

xml文件标签重复、格式不规范


报错3:Not registered via @EnableConfigurationProperties

给UserBean添加@ConfigurationProperties时,编译错误,是因为没有被添加为组件。@Component可以解决


报错4:Junit测试,使用 @SpringBootTest 爆红字,Cannot solve symbol

网上搜了很多方法,主要有

  • ①移动test位置到main中
  • ②<scope>test</scope> 注释掉
  • ③idea配置中删除 SpringBootTest.class 配置项
  • 导入的Junit版本冲突,看一下自己的SpringBoot依赖版本

错误5:浏览器访问 “Whitelabel Error Page“

看看是不是Application 启动类 的位置不对,启动类与扫描包同级


报错6:运行时异常 UnsupportedClassVersionError

java: java.lang.UnsupportedClassVersionError: org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

原因:

高版本的编译后文件,无法在低版本环境运行

那问题来了,哪来的高版本编译后文件?ConfigurationMetadataAnnotationProcessor 显然是 spring-boot-starter-parent 依赖引入的,3.02 换低版本 2.3.4即可

误删pom.xml,bug居然没了,大无语.....


错误7: Error resolving template [index]

[THYMELEAF][http-nio-8080-exec-5]

Exception processing template "index": Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers

原因:

Thymeleaf的声明放错了地方。。。,Thymeleaf 语法没报错,但页面解析不出来。

只要有一个页面使用了Thymeleaf,每个Html都要加Thymeleaf表头


8 java.io.IOException: Could not find resource mybatis-config.xml

mybatis总配置文件放错位置了,应该在resources下


9 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.mapper.UserMapper.selectUser

总配置文件映射错位


<mappers>
<mapper resource="com.atguigu.mapper.UserMapper"/>
</mappers>

10 Error building SqlSession

### Error building SqlSession.
### The error may exist in com/atguigu/mapper/UserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/atguigu/mapper/UserMapper.xml

解决1:mybatis-config.xml 的 mapper resource 路径写错了,应该以 / 作为分割

把conf.xml文件下的<mapper>里的 resource="com.easy.mapping.userMapper.xml" 改为 resource="com/easy/mapping/userMapper.xml"

解决2:静态资源拦截,在pom添加

    <build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>

  网上其他的解决方案:

class 路径下,接口和它的Mapper配置文件必须同名

接口和它的Mapper配置文件必须同一个包下

官方给出全限定名保证不出错

你可以多找找与路径相关的

在查询上面resultType="com.bing.pojo.User"这个有时候也需要全限定名


11 sql异常:You can't specify target table 'grade_tbl' for update in FROM clause

需求:删除重复条目(删除自动编号不同,其他信息相同的条目)

解决方法,给临时表起别名

# 错误
delete from grade_tbl where 自动编号 not in (select min(自动编号) from grade_tbl group by 学号,姓名,课程编号,课程名称,分数);
# 正确
delete from grade_tbl
where 自动编号
not in (select * from (select min(自动编号) from grade_tbl group by 学号, 姓名, 课程编号, 课程名称, 分数) as temp);

  

12 java.lang.NullPointerException 空指针异常

错误:在实现层,测试BookService,增删改查都是空指针异常。

解决:容器中没有BookService组件,BookService 字段上添加@Autowired

13、@Autowired的Service层报错

没有加入容器,service添加@service

SprintBoot2报错汇总的更多相关文章

  1. Ambari集成Kerberos报错汇总

    Ambari集成Kerberos报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.查看报错的配置信息步骤 1>.点击Test Kerberos Client,查看相 ...

  2. Python_环境部署及报错汇总(0)

    一.安装Anaconda Anaconda是一个开源的包.环境管理器,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换. Anaconda包括Conda.Python以及 ...

  3. ElementUI——报错汇总

    前言 elementUI的报错汇总 错误 please transfer a valid prop path to form item! vue.esm.js?c5de:628 [Vue warn]: ...

  4. selenium报错汇总

    selenium报错汇总 报错:[error] Could not connect to Selenium Server. Have you started the Selenium Server y ...

  5. Ubuntu操作系统编译安装zabbix报错汇总

    Ubuntu操作系统编译安装zabbix报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.报错提示:"configure: error: MySQL libra ...

  6. iOS 报错汇总

    1. Unknown type name 'class'; did you mean 'Class' 问题解决方法 objectice-c 工程中的类(比如 类 A)使用 C++ 文件时  A.m 文 ...

  7. FIM相关报错汇总

    1.错误1:FIM在修改MA名字的时候报错: The management agent cannot be deleted or renamed because the working directo ...

  8. masterha_check_repl报错汇总

    [root@DBMysql ~]#masterha_check_repl --conf=/etc/masterha/app1.cnf 导致如下报错的原因主要有两类: 1.mysql的安装时用源码安装, ...

  9. mysql安装/启动报错汇总

    2016/9/6补充 初始化报错: # /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysq ...

  10. eclipse 报错汇总

    1.Eclipse 启动时,报错: Fail to create the java virtual machine   已解决.方法:eclipse.ini 中-vmargs-Dosgi.requir ...

随机推荐

  1. docker 配置 anaconda + jupyter notebook 纪要

    首先,pull官方的镜像,名字叫:continuumio/anaconda3 首先的首先,如果默认还是需要sudo运行docker命令,可以考虑把当前用户加入到docker组(usermod -aG ...

  2. vue-多个卡片翻转动效

    <van-grid :column-num="2" class="content" :border="false" > < ...

  3. nRF51822蓝牙学习 进程记录 3:蓝牙协议学习--简单使用

    三天打鱼两天晒网,又学起了蓝牙,不过还好的是终于开始学习蓝牙协议部分了. 但是,一看起来增加了蓝牙协议的例程,真是没头绪啊.本身的教程资料解说太差了,看青风的蓝牙原理详解也是一头雾水. 经过不断地看各 ...

  4. 关于Lua中的面向对象实现

    写在前面 最近在琢磨"Lua热重载",在测试中发现我之前对Lua中的面向对象实现有一些理解发生变化,这里记录一下. 本文提到的面向对象实现来自云风. 类实现 <Lua程序设计 ...

  5. Blog作业03

    目录 前言 设计与分析 踩坑心得 改进建议 总结 前言 这三次作业的题目只有2道题,但是在题量减小的同时,这三次作业集的难度也相应的上去了,题目的质量很好,运用很广泛,也考验了很多的知识点.这三次的作 ...

  6. Leecode 21.合并两个有序链表(Java 迭代、递归两种方法)

      想法: 1.迭代 设两个指针pa和pb,不断移动pa和pb,并进行比较,则将较小元素接到新链表,该过程直至pa或pb为null,之后将未空的接到已空之后,得到升序链表   1 //官方: 2 cl ...

  7. vue项目 - 自定义数字输入指令 | 限制自定义小数位输入

    1.在main.js中直接加入代码: import Vue from 'vue' Vue.directive("input-limit", { bind(el, binding) ...

  8. .net 学习必须学的书籍,新手必备,老手升级必须品!!!

    最近看到一篇文章 是关于学习.net的数据 给大家看看. <<第一篇:>> 人身为一个典型的技术宅,平时看了一些技术书籍.算不上是"博览群书",但也涉猎不少 ...

  9. Linux高并发服务器之Linux多线程开发

    本文源自C++高薪面试项目的学习笔记,主要记录Liunx多线程的学习,主要知识点是线程概述等基础概念以外,还有线程相关Liunx系统函数以及对应练手代码,除此之外还有线程同步问题的讲解以及实战多线程买 ...

  10. vsftpd2.3.4 后门笑脸漏洞

    漏洞概要 在vsftpd 2.3.4版本中,在登录输入用户名时输入:)类似于笑脸的符号,会导致服务处理开启6200后门端口,直接执行系统命令 漏洞利用 攻击机:kali 2022 msfconsole ...