1—Caused by: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.jt.sys.dao.SysLogDao.getRowCount’. It’s likely that neither a Result Type nor a Result Map was specified.
原因:没有写resultType
2—Caused by: Ambiguous mappig.Cannot map ‘xxxController’ method
原因:RequestMapping值重复
3—警告:did not find a matching property
原因:在eclipse下,通过tomcat部署web工程时,tomcat的配置文件server.xml中会自动生成一个关于该web工程的配置信息,类似于下面的东西:Xml代码
view plaincopy to clipboardprint?
而默认情况下,server.xml的 Context元素不支持名称为source的属性,所以会发出警告。
解决办法:关闭tomcat,双击eclipse下tomcat服务器,在出来的Tomcat server at localhost页面中找到server options选项,选中其中的选项”Publish modual contexts to separat XML files“,ctr+s,启动tomcat
4—404
原因:web.xml中,display-name标签工程名字不对
还有可能是Controller没有加ResponseBody注解
没有加请求后缀,如.do .html等
5—SpringMVC @DateTimeFormat失效
原因:没有开启MVC默认配置
6—Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 47; 文档根元素 “mapper” 必须匹配 DOCTYPE 根 “null”
原因:没有拷贝约束头文件
7—js访问不到方法
原因:可能是方法写重复了
8—maven不能自动下载jar包和目录结构
原因:将.m2文件夹内,残留的jar包删除即可
9—Caused by: java.lang.IllegalStateException: Configuration error: No realms have been configured! One or more realms must be present to execute an authentication attempt.
原因:没有写shrio的Service或SecurityManager方法没有setRealm(userRealm);
10—tomcat启动出错"A child container failed during start"
原因:servlet-name标签的名字写的不一致
11—bean创建异常或找不到bean
原因:可能是spring.xml文件没有引入
12—没有找到合适的bean
原因:可能是bean的id或者是配置文件重复了,比如xml和注解方式都写了
13—js jquery混合使用页面没有效果
原因:js不能和jquery混用
14—页面向RequestMapping传值乱码
原因:过滤器没有成功拦截请求,应该写/*
15—Mapper root cause
16—slave_io_runing no
原因:查看/var/log/mysqld.log文件 可能是uuid重复,修改auto.cnf文件中的uuid值,
还可能是position值写错,导致挂载时错误
17— slave_sql_runing no
原因:重新 stop slave start slave即可
18—[ERROR] Slave SQL: Slave failed to initialize relay log info structure from the repository, Error_code: 1872
原因:一般是由relay log没有在配置文件定义所致,在my.cnf配置文件中添加如下项:
relay_log = /opt/mysql/logs/mysql-relay-bin,重启mysql实例使其生效
重新连接master
19—mycat启动成功,但是无数据
原因:可能是端口写错 默认端口8066
20—开启虚拟机时黑屏
原因:在命令符窗口中输入"netsh winsock reset",然后重启计算机即可解决
若还不行,在VM-Settings-Hardware-Display在右面内容栏中将Accelerate 3D graphics取消打勾,然后重启电脑即可
21—eclipse无法连接虚拟机的redis
原因:配置文件中protected-mode改为no
22—nginx连接404
原因:可能是nginx.conf域名写错,还可能是启动了两个ngnix(有4个进程)
23—安装docker
步骤一:将以前下载好的Docker卸载干净, 使用如下命令:
yum remove docker-*
1
步骤二:更新该Liunx系统的内核版本,使用如下命令:
yum update
1
建议更新完之后, 重启一下系统
步骤三:继续下载安装docker(尽量使用高级管理员权限下载)使用如下命令
yum install dacker
1
步骤四:使用如下命令启动docker
systemctl start docker
1
问题解决!
如果这样安装完之后还报错, 按照这个步骤再来一遍即可
如果使用docker命令时出现如下错误:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
1
第一个原因可能是因为docker没有启动
第二个原因就是因为docker出现错误
归根结底都是docker启动问题, 解决方案还是以上步骤
安装docker 时候出现以下问题
yum -y install docker
Loaded plugins: fastestmirror
Determining fastest mirrors
- base: centos.uhost.hk
- extras: mirrors.btte.net
- updates: mirror.bit.edu.cn
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:47
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 2.5 MB 00:20
Setting up Install Process
No package docker available.
Error: Nothing to do
yum没有找到docker包,更新epel第三方软件库,运行命令:
sudo yum install epel-release
之后运行
sudo yum install docker-io
即可
安装文档 http://www.runoob.com/docker/centos-docker-install.html
24—Navicat 远程连接docker容器中的mysql 报错1251 - Client does not support authentication protocol 解决办法
1,容器中登录mysql,查看mysql的版本
mysql> status;
mysql Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL)
2,进行授权远程连接(注意mysql 8.0跟之前的授权方式不同)
授权
GRANT ALL ON . TO ‘root’@’%’;
刷新权限
flush privileges;
此时,还不能远程访问,因为Navicat只支持旧版本的加密,需要更改mysql的加密规则
3,更改加密规则
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
4,更新root用户密码
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘password’;
刷新权限
flush privileges;
OK,设置完成,再次使用 Navicat 连接数据库
25—docker启动应用命令
docker exec -it mysql04 bash
26—shiro登录不上 报错 realms Not been
说明自己配置的realm没有加入容器,或者是shiro配置类里没有用setRealm()方法,设置进去
27—org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
可能是Xml文件名写错,或者没有写文件后缀,或者没有读取到
28—springboot报错,不能只看cause by 要仔细看日志,有可能错误在第一行
29—jdbc连接,数据库密码错误 password:(no)
有肯能是springboot里的 username password 写成了 data-username data-password 因为spring版本不对(自动添加jpa jdbc模块的,用data-,自己添加依赖的,不需要)
30—Thu Jun 27 15:28:18 CST 2019 WARN: Establishing SSL connection without server’s identity verification
is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established
by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property
is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server
certificate verification.
设置url为: url: jdbc:mysql://192.168.47.141:3306/tensquare_base?characterEncoding=utf-8&useSSL=false
31—pom文件报错,Maven报错
可能是spring-boot-… 中的’-'写成中文的了,这样maven会下载下来写错的包,但是包里面没内容,需要把错误的包删除,再重新导入
32—Redis安装失败
可以使用rm -rf 命令把所有redis和redis-* 相关的全部删除,重新安装即可
33—springboot无法加载主类
可能不是代码问题,可以把主类重新写一下,重新编写,重启电脑
34—springcloud yml文件没有提示,没有EnableEurekaServer注解
是约定的版本不对,选择适当的版本(注意:springboot和springcloud版本也要对应上)
Finchley Edgware等
35—Idea整合码云,创建仓库成功,代码上传不上------Clone git repositories use ssh不勾选即可成功
36—Circular view path [index]: would dispatch back to the current handler URL [/index] again. Check you------没有引入maven依赖template
37 BeanCreatedException SqlSessionFactory----错误不一定是这个对象本身失败,可是是由于Mapper文件里定义的类找不到,所以看到此错误,一定要把错误信息拉到最后,看详细的原因
38 org.springframework.web.servlet.DispatcherServlet.noHandlerFound No mapping for GET------可能是因为没有加controller注解或包扫描路径不对,还可能是路径写错了(多写了几级)
39 layUI page 分页上一页下一页失效,没有拿到数据------是由于加载数据的方法没有设置为同步方法导致的,应该加载完数据,再进行分页
ava.lang.IllegalArgumentException:No converter found for return value of type: xxx类------仅仅引入了jackson,但该类没有生成get set方法,所以不能转json格式字符串
40 VM141:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at Object.success (:19:23)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
at XMLHttpRequest. (jquery.min.js:4)
------后台直接传的Json对象,前台用JSON.parst()接受,所有报错了,因此不需要转换Json对象,本来后台传的就是对象
41 JS 两个字符串比较大小无效 “”>"" ------用parseInt方法转换成字符串即可
42 全局异常处理类注解失效 @ControllerAdvice,@ExceptionHandler(ServiceException.class) ------没有配置包扫描:<context:component-scan base-package=“com.jt.sys.exception”/>,需要把全局异常处理类扫描到Spring容器中
43 加载TreeTable表格不成功,直接打印Json串 ------ 访问的请求地址写错了,写成了别的,直接加载Json数据的请求地址了,要看清楚主页加载分页,以及所有相关的请求地址是否正确,不然可能找半天,方向错了也发现不了问题
44 delete和put请求参数为空的问题------
原因:
Tomcat处理参数的问题:
1.将请求体中的数据,封装成一个map
2.request.getParameter(“id”)就会从这个map中取值
3.SpringMvc封装POJO对象的时候, 会把POJO中每个属性的值进行request.getParamter();
4.AJAX发送PUT,DELETE请求引发的PUT,DELETE请求,请求体中的数据,request.getParamter()拿不到
Tomcat一看是PUT,DELETE就不会封装请求体中的数据为map,只有POST形式的请求才封装请求为map。
解决办法:
在web.xml配置文件中添加一个将post请求转换为delete或put请求的filter:
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HiddenHttpMethodFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
配置好后:前端ajax请求参数data需要加_method:"put或者delete"属性;
注意ajax请求必须是post:type:‘post’
type:“post”,data:{ _method : “put”, “id”:id} 或
type:“post”,data:{ _method : “delete”, “id”:id}
WebStorm中文乱码 ------ 解决方法:file -----> settings 搜索encoding,在fileencoding下,将IDE Encoding,Project Encoding和下面的Default Encoding for properties file都更改为utf-8,还有可能是导入的项目配置不同,可以新建一个项目,拷贝除.idea文件夹之外的所有内容,即可解决问题。
form表单绑定submit事件不起作用 ------ 可能是由于绑定位置写错引起的,绑定该事件需要在form标签上绑定,绑定数据也是在该标签上,而不是在提交按钮上绑定。
400错误 ------ 可能是传递的参数类型不对
Artifact contains illegal characters------是因为创建项目的时候,名字采用了大小写混合,改为全大写或全小写即可
SpringBoot使用@Mapper和@MapperScan注解无效
Description:
Field studentMapper in com.example.service.impl.StudentServiceImpl required a bean of type ‘com.example.mapper.StudentMapper’ that could not be found.
Action:
Consider defining a bean of type ‘com.example.mapper.StudentMapper’ in your configuration.
------ 缺少jar包
<!--缺少此jar包,导致@Mapper注解无效-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.2.0</version>
</dependency>
45 Caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.atguigu.mybatis_test.test1.User with invalid types () or values (). Cause: java.lang.NoSuchMethodException: com.atguigu.mybatis_test.test1.User.() ------ model中的get/set方法与成员变量不一致。对相应的变量添加getter和setter方法。
构造函数重载过后,没有添加无参的构造函数。添加无参的构造函数。
46 Page directive: illegal to have multiple occurrences of contentType with different values (old: text/html; charset=UTF-8, new: text/html; charset=utf-8) ------ 包含页面与被包含页面的@page指令里面的contentType等信息不一致
47 代码修改了不生效,或者参考代码完全一致,就是结果不对 ------ 最简单的往往是最容易忽视的,大概率是因为写错文件了
48 js中 “XXXX is not a constructor” ------ 变量名和构造方法名字重复
49 idea不编译 ------ 首先添加相关jar包,然后设置输出路径,把src目录设置为source root文件夹即可
50 IDEA 'Error:java: 无效的源发行版: 12 ------ 1.ctrl+alt+shift+s
2.选第八个就行