文章目录

  • 学习编程过程中-->遇到的错误(吕招焕)
    • 1、java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
      • 详情如下图所示
    • 2、SpringMVC静态资源过滤The matching wildcard is strict, but no declaration can be found for element 'mvc:default-servlet-handler
    • 3、IDEA JavaWeb报错SSL HTTP Connector node not found set up one in the server.xml(2021-10-8)
    • 4、currentTime2 is not a function 如下图 (2021-10-8)
    • 5、springboot无效的目标发行版11 如图
    • 6、Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader 使用SpringBoot测试的时候Junit报错
    • 7、请求的资源[/]不可用 做ssm实训课的时候这个错误真的是让我很难受,浪费几天时间结果是webapp这个文件夹配置错误
    • 8、org.springframework.jdbc.BadSqlGrammarException:
    • 9、请求的资源[/jsp/provider.do]不可用(源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示。)
    • 10、org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
    • 11、springboot项目控制台日志不是彩色的原因
    • 12、线程“main”java.lang.NoSuchMethodError中出现异常:org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader;
    • 13、Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
    • 14、Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
    • 15、java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required
    • 16、
    • 17、为bean类[cn.qztc.bookstore.controller.client.userController]指定的注释bean名称“userController”与相同名称和类[cn.qztc
    • 18、java.sql.SQLException: Connections could not be acquired from the underlying database!
    • 19、org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.tree.mapper.NoticeMapper.listAll'. It's likely that neither a Result Type nor a Result Map was specified.
    • 20、Tomcat启动报错:一个或多个筛选器启动失败。由于之前的错误,Context[]启动失败
    • 21、(Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader; )
    • 22、org.springframework.beans.factory.UnsatisfiedDependencyException:Error creating bean with name 'com.freedom.tkmapperdemo.dao.UserDAOTest': Unsatisfied dependency expressed through field 'userDAO'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.freedom.tkmapperdemo.dao.UserDAO' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    • 23、Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseInsertProvider.dynamicSQL).
    • 24、前后端分离项目 vue+axios 跨域传参一直是undefined
    • 25、使用js从购物车列表传参调转到登录页面的时候,发现自己定义的变量提示undefined且登录之后无法回到购物车页面
    • 26、在做mapper层的foreach查询的时候,遇到Parameter 'cids' not found. Available parameters are [arg0, collection, list]
    • 27、针对cookie无法处理特殊字符的解决方案
    • 28、SpringBootTest测试类没有启动按钮,测试类无法启动
    • 29、Application run failed org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key in 'reader', line 10, column 1:
    • 30、Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory. NoSuchBeanDefinitionExceptionNo qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as
    • 31、使用springboot做jdbc测试出现了错误
    • 32、使用vue创建项目错误 vue init webpack myproject

学习编程过程中–>遇到的错误(吕招焕)

1、java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).

(翻译:找到了1个问号,却插入了2个值,导致参数越界(根据得到的信息打印将很容易判断数据是否与数据库字段匹配等小问题))

详情如下图所示


在查询了许多资料之后,大概都是说sql语句参数设置发生了错误

  • 第1 种情况:就是当设置参数时,没有相应的问号与之匹配(或者根本就没有?号)
  • 第2 种情况:动态sql语句中where标签使用的时候,由于在select标签中按快捷键添加了注释,导致出现错误,-- 只要把注释去掉或者改成正确的注释格式就可以成功运行
  • 最后通过查看BaseDao类 发现我的错误是sql语句中的问号大小写错了。 找了半天,绝了…

    找了将近一个小时,终于解决了…

2、SpringMVC静态资源过滤The matching wildcard is strict, but no declaration can be found for element 'mvc:default-servlet-handler

(翻译:匹配的通配符是严格的,但找不到元素“mvc:defaultservlet处理程序”的声明)

仔细查找了一下,发现是bean的配置出错了 后缀的cache给写错了 应该是mvc
可能改完之后 你还会报错…因为需要改的不止这一条,还有下面这两条

Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 29; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 ‘mvc:annotation-driven’ 的声明。

3、IDEA JavaWeb报错SSL HTTP Connector node not found set up one in the server.xml(2021-10-8)

(翻译:IDEA JavaWeb报错未找到SSL HTTP连接器节点。请在server.xml中设置一个)

1、不使用Https端口,在IDEA的Tomcat配置中去掉HTTPs端口即设置为空
2、翻译:IDEA JavaWeb报错未找到SSL HTTP连接器节点。请在server.xml中设置一个
2.1 打开Tomcat下的conf目录里的server.xml文件
2.2 把文件里面定义的SSL连接器注释去掉

4、currentTime2 is not a function 如下图 (2021-10-8)


代码这边找了十几分钟都没发现,最后发现自己傻了 计算属性写成了方法

5、springboot无效的目标发行版11 如图


解决方案:
这个是项目配置的JDK版本有误,解决方案如下:

 1、File——>Settings——>Build,Execution,Deployment——>Compiler——>Java Compiler


2、Project Structure——>Project
最后成功启动啦!

如果还是报错,检查下maven的pom文件,将下列信息注释

6、Exception in thread “main” java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader 使用SpringBoot测试的时候Junit报错


原因:依赖的junit的版本的问题,junit5在低版本的IDEA上会报这个错误(我当时使用2017版)
解决方案:pom文件中移除junit 如下图所示,并且重新在测试类中导入Junit4的包

7、请求的资源[/]不可用 做ssm实训课的时候这个错误真的是让我很难受,浪费几天时间结果是webapp这个文件夹配置错误

这里参考了 记idea部署ssm项目(Tomcat)网页报404请求资源不可用问题(已解决
左侧文件夹路径一定要和右侧的资源路径一样 ,并且webapp是要标记的 有个小蓝点

8、org.springframework.jdbc.BadSqlGrammarException:

很明显 已经提示是sql语句语法异常

原来sql语句连接就给搞错了 如上图蓝色矩形内容

9、请求的资源[/jsp/provider.do]不可用(源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示。)


原因是我忘记了配置web.xml

10、org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

即在mybatis中dao接口与mapper配置文件在做映射绑定的时候出现问题,简单说,就是接口与xml要么是找不到,要么是找到了却匹配不到。


记住:接口名与Mybatis的映射文件名一定要一模一样

11、springboot项目控制台日志不是彩色的原因

采用springboot的方式启动,而不是application的方式启动

application的方式启动

springboot方式

12、线程“main”java.lang.NoSuchMethodError中出现异常:org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader;

Exception in thread “main” java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader;

解决方案:
1、添加了mysql 5.1.47依赖
2、去掉junnit-jupiter-api

3、换掉springboot主类的Junit Test

13、Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.

在做锋迷商城 整合Druid的时候遇到所谓的url错误 如下图

找了半天的yml文件里面真的没发现错误,翻阅了之前写的笔记才发现。。。原来是我把yml文件放错了位置 应该要放在resource目录下 结果放在同级

14、Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver’. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

mysql后面加上cj就行了

15、java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

原因就是默认的版本太高了,换个版本比如5.1.47就行了

完美运行!!

16、

17、为bean类[cn.qztc.bookstore.controller.client.userController]指定的注释bean名称“userController”与相同名称和类[cn.qztc

这个报错把主要意思翻译过来就是说,在你的上下文中含有一个相同的userController,只要删掉一个重复的就可以

18、java.sql.SQLException: Connections could not be acquired from the underlying database!

Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

根据描述可以得知主要是数据库连接不上的问题,
各种百度然后说的最多的解决方案是:

1,驱动配置有误;
2,数据库连接地址有误;
3,密码或帐号有误;
4,数据库未启动或无权访问;
5,项目未引入对应的驱动jar包;
检查了一下,导包的时候版本是8.0,8.0的url配置和5.x版本的不一样需要加一个时区配置,并且driver驱动需要加cj

19、org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.tree.mapper.NoticeMapper.listAll’. It’s likely that neither a Result Type nor a Result Map was specified.

原因是没写 mapper 映射

20、Tomcat启动报错:一个或多个筛选器启动失败。由于之前的错误,Context[]启动失败

在Maven工程中,IDEA没有吧项目依赖包部署到web项目,需要手动导入包
![在这里插入图片描述](https://img-blog.csdnimg.cn/f35a645aec5d4f898f71b2fe2342af14.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5ZCV5oub54SV,size_20,color_FFFFFF,t_70,g_se,x_16

21、(Exception in thread “main” java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader; )


我们用的是Junit4.2,但是测试一直自动用junit5,根据自己的情况,可能是升级自己没有修改。

22、org.springframework.beans.factory.UnsatisfiedDependencyException:Error creating bean with name ‘com.freedom.tkmapperdemo.dao.UserDAOTest’: Unsatisfied dependency expressed through field ‘userDAO’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.freedom.tkmapperdemo.dao.UserDAO’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


这里真的是傻了 把springboot主类的MapperScan注释掉了,取消注释完美运行

23、Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseInsertProvider.dynamicSQL).

在SpringBoot的启动类上,使用@MapperScan注解时引入了错误的包下的。
正确的应该是:import tk.mybatis.spring.annotation.MapperScan;
错误的引入了:import org.mybatis.spring.annotation.MapperScan;

24、前后端分离项目 vue+axios 跨域传参一直是undefined

原因是:两个对象 我只解析了一次 导致undefined,最后是在页面输出测试的时候才发现后端已经把数据发过来,自己输出就是undefined所以怎么传给其他页面都是undefined

25、使用js从购物车列表传参调转到登录页面的时候,发现自己定义的变量提示undefined且登录之后无法回到购物车页面

找了半天真的什么都没发现很难受,最后在群里别人说this没写,人都傻了。。。写完之后没毛病

26、在做mapper层的foreach查询的时候,遇到Parameter ‘cids’ not found. Available parameters are [arg0, collection, list]

报错提示的是在 78 行的地方错误,
at com.freedom.ApiApplicationTests.testShopCart(ApiApplicationTests.java:78)


在百度查资料之后发现,Mapper传参那里似乎写的不行。
这是是返回一个列表(即多个参数),需要指定参数名
参考了:https://www.cnblogs.com/xuesheng/p/7485338.html

修改了之后,完美运行

27、针对cookie无法处理特殊字符的解决方案

在前端js页面的处理
1、通过encodeURIComponent(URIstring)对URL进行编码
2、decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码

28、SpringBootTest测试类没有启动按钮,测试类无法启动

解决方法,在测试类和测试方法加上public关键字即可

29、Application run failed org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key in ‘reader’, line 10, column 1:

确保yaml文件中没有错误,我就是yaml写错导致的
application.yml文件键值之间要用冒号:隔开,而且冒号和值之间有一个空格,否则就报上面的错误!

30、Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory. NoSuchBeanDefinitionExceptionNo qualifying bean of type ‘java.lang.String’ available: expected at least 1 bean which qualifies as

翻译:没有“java”类型的合格bean。Lang.Studio可用:预期至少1个bean,符合

提示没有找到NoSuchBeanDefinition 原因是springioc容器加载bean默认使用无参构造进行初始化。
1.无参构造方法实例化(Spring默认,常用,需要bean类中存在无参构造方法);
2.静态工厂实例化
3.实例化工厂实例化
4.注解方式实例化

31、使用springboot做jdbc测试出现了错误

第一个是在IDEA2017.1无法使用Junit5版本,降低到Junit4之后还是报错,需要移除junit-jupiter-api 并且 在springboot测试类中的类和方法前加上public关键字,和@RunWith(SpringRunner.class)注解即可正常运行

          <exclusions><exclusion><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter-api</artifactId></exclusion></exclusions>


第二个在于yaml文件中配置的数据源,
如果MySQL版本大于等于6,使用driver-class-name: com.mysql.cj.jdbc.Driver
小于6均使用driver-class-name: com.mysql.jdbc.Driver

32、使用vue创建项目错误 vue init webpack myproject

Failed to download repo vuejs-templates/webpack: read ECONNRESET

解决:要安装正确的npm淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org;

学习编程过程中-->遇到的错误相关推荐

  1. c语言编程过程中的常见错误,C语言编程常见错误与解决办法

    warning: excess elements in array initializer 警告:数组初始值设定项中有多余元素 (定义的数组长度比赋值的个数小) 数组定义出错 "confli ...

  2. c语言错误出在花括号上,初学者在学习c语言编程过程中常出现的错误分析

    在高校经常中开设的第一科关于程序设计的语言就是C语言,这种语言有很多优势,比如说使用比较灵活,功能比较强大,可以用于编写程序.软件,但是对于初学者来说, 1 0 8 应用方法论 22第霸 0赫 6乱 ...

  3. 自己学习c++过程中写下的笔记,只做基础了解使用

    01书写helloworld #include <iostream> using namespace std;int main() {cout << "Hello W ...

  4. python之禅 中文_《Python之禅》中对于Python编程过程中的一些建议

    <Python之禅>中对于Python编程过程中的一些建议 来源:中文源码网    浏览: 次    日期:2018年9月2日 [下载文档:  <Python之禅>中对于Pyt ...

  5. Qt的日常编程过程中遇见的问题和使用

    Qt的日常编程过程中遇见的问题和注意 Qt的日常编程过程中遇见的问题 1.QString和String的转化的格式问题,中文转化过程中会出现问题. 2.使用qcustomplot的时候出现错误:LIN ...

  6. 拯救者Y9000P 安装Ubuntu18.04 、Ros Melodic等相关配置过程中出现的错误及解决办法

    电脑配置:拯救者Y9000P 2022 i9 3060 目录 一.安装Ubuntu18.04 1.安装UltralSO时无法写入镜像文件,显示磁盘/映像空间太小 2.由于2022拯救者Y9000PBI ...

  7. Sql Server 因为触发器问题导致数据库更新报错“在触发器执行过程中引发了错误,批处理已中止”的问题处理...

    在维护一个非常旧的项目时,由于该项目版本已经非常老了,而且在客户现场运行的非常稳定,更要命的是本人目前没有找到该项目的代码,为了处理一个新的需求而且还不能修改程序代码,于是决定从数据库入手,毕竟该项目 ...

  8. hadoop过程中遇到的错误与解决方法

    hadoop过程中遇到的错误与解决方法 参考文章: (1)hadoop过程中遇到的错误与解决方法 (2)https://www.cnblogs.com/zhjh256/p/10669881.html ...

  9. 统一处理jquery ajax请求过程中的异常错误信息的机制

    统一处理jquery ajax请求过程中的异常错误信息的机制 参考文章: (1)统一处理jquery ajax请求过程中的异常错误信息的机制 (2)https://www.cnblogs.com/wi ...

最新文章

  1. rust 官服指令_RUST 命令大全(包括服务器指令)
  2. Windows IIS配置Jsp和php环境方法
  3. 课时 28:理解容器运行时接口 CRI(知谨)
  4. CKEditor 4编辑器已与Vue.js集成
  5. elementui表格中tip设置_VUE2.0+ElementUI2.0表格el-table:表头扩展el-tooltip
  6. spss分析方法-T检验
  7. 三级等级保护之安全物理环境
  8. win7系统下文件夹重命名提示找不到该项目:的解决!
  9. Java300StudyNote(7)-Java各版本JavaSE、JavaEE、JavaME
  10. 推荐一些好的音乐资源的网站(大家可跟贴 ^_^ )
  11. FFT—音频频谱设计
  12. 前端开发规范和开发文档的书写规范
  13. Python文件,照片批量重命名脚本
  14. 【日常Exception】第二十回:SQL 错误 [3185] [HY000]: Can‘t find master key from keyring, please check in the xxx
  15. 软考详细备考攻略,肝了
  16. 零点起飞学C语言pdf
  17. python API 源码
  18. Studio One6Mac中文免费版数字音乐工作站DAW
  19. 2023最新Android 车载系统开发教程,车载开发入门
  20. 东奔西走 花样百出魂牵梦萦 东奔西走

热门文章

  1. 阿里云服务器配置Tomcat
  2. 从零开始搭建神经网络(五)卷积神经网络(CNN)
  3. [POI2006] TET-Tetris 3D
  4. 中国体育赛事产业发展现状及未来前景展望报告2021-2027年
  5. Latex 中如何使插图的位置不跑到开头而紧跟插入的文字后
  6. CSS学习笔记7—盒子模型
  7. 解决域名在部分网络上打不开问题
  8. MySql中用sql语句实现按汉字首字母排序
  9. Java获取本月第一天是本周第几天
  10. GitHub 上值得收藏的100个精选前端项目!你知道几个?