日常开发报错

该文章已生成可运行项目,

1."\n### Error updating database. Cause: dm.jdbc.driver.DMException: Error in line: 1\nInvalid table or view name [T_SINGLE_LOGIN_LOG]\n### The error may exist in com/chinatower/product/manage/modules/log/singleLoginLog/mapper/SingleLoginLogMapper.java (best guess)\n### The error may involve com.chinatower.product.manage.modules.log.singleLoginLog.mapper.SingleLoginLogMapper.insert\n### The error occurred while executing an update\n### SQL: INSERT INTO T_SINGLE_LOGIN_LOG ( ID, IP, USER_ID, USER_NAME, DEPT_CODE, DEPT_NAME, COMPANY_CODE, COMPANY_NAME, MOBILE, LOGIN_TIME, STATUS, MEMO, SERVER_IP, CLIENT ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\n### Cause: dm.jdbc.driver.DMException: Error in line: 1\nInvalid table or view name [T_SINGLE_LOGIN_LOG]\n; Error in line: 1\nInvalid table or view name [T_SINGLE_LOGIN_LOG]"

原因:表不存在
解决:创建一张对应表即可

2."\n### Error updating database. Cause: dm.jdbc.driver.DMException: String truncated\n### The error may exist in com/chinatower/product/manage/modules/system/mapper/DictManageMapper.java (best guess)\n### The error may involve com.chinatower.product.manage.modules.system.mapper.DictManageMapper.insert-Inline\n### The error occurred while setting parameters\n### SQL: INSERT INTO T_SYS_BASICS_DICT ( ID, PARENT_ID, TYPE, VALUE, LABEL, ORDER_NO, REMARKS, STATE, DEL_FLAG, CREATE_USER, CREATE_TIME ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\n### Cause: dm.jdbc.driver.DMException: String truncated\n; String truncated"

原因:字符串截断,也就是说,设计表结构时,字段长度设置为50,但是却尝试插入60长度的字符串,那肯定报错

解决:要么前端校验一下,要么表字段长度设置更大

3.业务功能报错

场景:项目上线后出现功能上的bug,上线前都没有任何问题,并且测试环境也没有问题

原因:数据库迁移操作,达梦数据库迁移后的数据将原本为null的数据库修改为空串,导致后端代码的if校验失效

解决:将数据置null即可

4.[pom 文件报错 ] [ERROR] Some problems were encountered while processing the POMs: clear

场景:由于来回切换分支过于频繁,导致maven报错,但不影响项目启动,这就是很神奇的点了,处理完maven报错后,maven的clean等功能不能使用,老是报父pom中的一些依赖不可用,无法加载

解决:试过很多方法,固定版本号,删除maven重新拉,更换maven版本,清除缓存------没用

           直接抛弃代码,重新拉取代码分支------解决

5.org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' is not supported

原因:接口不正确,代码是post请求,但是你的请求类型是get

场景:浏览器直接复制接口地址进行访问,浏览器通常只支持get请求

6.功能报错

现象:根据时间范围进行数据查询,开始时间和结束时间,均可选,不传时间默认查询全部

报错:任意时间选择后,然后叉掉时间,点击查询,后端时间对象Date接收说string不能转换为时间格式

原因:前端使用的组件问题,不选时间直接点击查询,字段是没有值的,但是前端这个组件中,先选择时间,然后叉掉时间,该字段按理是没有值的,最后却传递过来是个null值,还是字符串类型的“null”,所以才会报错,我是后端,前端解决     0.0

7.idea    解析依赖    resoving maven dependencies卡住了


下面打框的地方加上:-Xms1024m -Xmx2048m

8.Command line is too long.Shorten command line for

 命令太长了,之前都没有,然后突然就出现了

1.点开启动有误的服务进行edit

2.按照这样处理

3.apply      run   即可

9.Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.

意思是:要么重新中断该方法,要么重新抛出在这里可以捕获的 “InterruptedException”

例如:

                try {
                    future.get();
                } catch (InterruptedException e) {
                    log.error(e.getMessage());
                } catch (ExecutionException e) {
                    System.out.println("线程失败: " + e.getCause().getMessage());
                    log.error(e.getCause().getMessage());
                }

修改为:加上   Thread.currentThread().interrupt();    重新标识中断

                try {
                    future.get();
                } catch (InterruptedException e) {
                    log.error(e.getMessage());
                    Thread.currentThread().interrupt();
                } catch (ExecutionException e) {
                    System.out.println("线程失败: " + e.getCause().getMessage());
                    log.error(e.getCause().getMessage());
                }

10.用户提出xx系统跳转至自己系统报错

现象:用户点击我们系统后,浏览器弹出,是否访问xxx地址,该地址是我们系统的单点登录地址,然后过了一段时间点击继续访问,报错接口方式不正确

原因:我们系统是post接口,但是日志这边是get?所以判断可能是因为弹出页面时间过长导致会话失效,一般来说浏览器是不会改变原有的接口请求方式,但是失效的话,不是改变原有的请求方式,二十直接由浏览器发送了该请求,浏览器直接发送请求时get请求,导致此次报错
解决:用户重新登陆下,点击跳转就没问题

 11.Error running 'UserTest.test': Failed to resolve org.junit.platform:junit-platform-launcher:1.5.2

原因:使用junit时idea尝试连接到Maven中央仓库,而不是自己配置的maven仓库

解决:pom.xml导入下面依赖

<dependency>
    <!-- this is needed or IntelliJ gives junit.jar or junit-platform-launcher:1.3.2 not found errors -->
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-launcher</artifactId>
    <scope>test</scope>
</dependency>

12.Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [cn.itsource.user.domain.LoginInfo]

原因:redis保存数据需要序列化【String和包装类本身就实现了序列化接口,对象需要手动实现序列化接口】

解决:手动序列化即可

13.java.net.ConnectException: Connection refused: no further information

原因:老是不长记性,每次都没启动redsi

解决:启动redis(记一下,长记性)

14.XML 解析错误:格式不佳 位置:file:///D:/menu-review/shoplist.json 行 1,列 1:

原因:可能是拦截器把请求拦截了

15.rocketMQ java: 无效的目标发行版: XX

原因:这是因为jdk版本不不对应,我用的是1.8,之前配置的是17

解决:项目结构、设置中的java Compiler把jdk版本设置相同版本即可

16.MySQLIntegrityConstraintViolationException: Column 'id' in where clause is ambiguous;

原因:通常是由于 SQL 查询中的 WHERE 子句中的列名在多个表中存在,导致无法确定具体是哪个表的列,可以将列名前面添加表名或者表的别名,以明确指定使用的列

17.No qualifying bean of type 'cn.zhuama.zmcc.mapper.ConfigMapper' available: expected at ...

原因:主启动类没有扫描mapper接口

解决:添加扫描或者查看自己扫描路径是否出错

 18.pom.xml文件变灰色的解决方案

解决:Setting→Build Tools→Maven->Ignored Files ,找到被打勾忽略的Module,然后将Ignored Files中的打勾去掉即可

19.closeChannel: close the connection to remote address[] result: true

原因:rocketmq没有连接<环境变量没有配置或者配置不正确>

20.No route info of this topic,XXX

场景:做远端推流时报错

发现:启动rocketMQ时,发现启动的三个窗口中的broker窗口不正确,也就是web客户端中发现               topic、message什么都没有

原因:MQ的日志文件中有脏数据【这里主要是store文件】

解决:删除store文件,还不行就把logs文件删除甚至注册表【ps:就算重装,也要把store文删除             才有效果】

21.前后端数据交互时id属性被转换为XXX....400

原因:装不下了,数据太长了【id数据长度超过script范围错误】,因为后端是自增id,后续应该遇不到了,都是字符串了

22.The bean ‘course-service.FeignClientSpecification‘ could not be registered

原因:应用程序的上下文中已经存在一个名称为 ‘service-uaa.FeignClientSpecification’ 的bean,并且禁止了重写。这可能是由于多个地方都定义了相同名称的bean。

通俗易懂原因:微服务框架中,使用了注册发现,在bootstrap.yml拉取远端配置时就发生报错,远端配置文件中allow-bean-definition-overriding: true还没生效

我的解决:因为调用了远程服务,我认为可能因为依赖导入的原因导致一个服务多次导入了相同的远程服务,所以将相关的pom.xml中重复的,没必要的依赖删除后解决。

研究后的简单解决:直接在bootstrap.yml文件中配置allow-bean-definition-overriding: true

23.MQClientException: readLocalOffser Exception, maybe fastjson version too low

场景:电脑死机、蓝屏等故障导致未正常关闭

解决:在c盘中找到.rocketmq_offsets文件夹,删除里面的@DEFAULT后缀的文件夹

24.虚拟机连接不上网络

原因:打开终端后,输入ipconfig指令,发现没有ens33

解决:依次输入下列命令

systemctl stop NetworkManager
systemctl disable NetworkManager
ifup ens33
service network restart

之后可以先重启虚拟机再次查看就有了ens33,但是会发现ip和之前的不一致,不影响正常使用。

25.Local changes were not restored.Before update your uncommitted changes were saved to shelf. Update i

场景1:长时间没有推送和拉去代码,然后进行推送代码时远程拒绝,接着拉去代码报错

场景2:当前在dev1分支,为提交代码,然后签出dev2分支,报冲突,签回dev1后发现未提交代码丢失

原因:更新未完成,工作树中有未解决的合并解决冲突,完成更新并手动还原更

解决:将工作目录的代码进行手动更新即可,有时候需要自己将代码复制过去

26.Plugin ‘org.apache.maven.plugins:maven-compiler-plugin:‘ not found报错

 场景:处理完冲突报错

代码:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>

无论如何更新maven都报错

org.jboss:jboss-parent:pom:39 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.jboss:jboss-parent:pom:39 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/146.75.112.215] failed: Connect timed out

Try to run Maven import with -U flag (force update snapshots)

检查配置文件,都是正确的

解决:去本地仓库找到并查看对应的版本,然后加上对应版本,例如:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<version>3.1</version>
</configuration>
</plugin>

然后更新maven,不报错了,这时候删除这个版本号也不会报错了

 27.Command line is too long.Shorten command line for SpringBootMainApplication or also for Application default configuration

原因:springboot项目启动命令过长。

解决:

28.Verify the message's origin in this cross-origin communication

原因:在跨源通信中验证信息的来源
场景:在俩监听函数中报错

查找原因后问题:认为是钩子函数问题

解决:把键盘函数加入方法中,mounted中写监听器,使用完处理掉监听器

29.Unexpected duplicate "line-height"

问题:css样式语句中重复,例如:line-height: 20px;与line-height: 0px !important;

解决:css优先级规则; !important优先级更高,将前面重复的删掉即可

30.Remove this conditional structure or edit its code blocks so that they're not all the same

问题:某个条件结构(如 if 语句、switch 语句等)中所有的代码块都是相同的

解决:只要代码块即可

31.Expected an assignment or function call and instead saw an expression.

问题:要么有多余的表达式要么就是没有return;

解决:逻辑修改一下或者加上return即可

32.### Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.String

问题:xml中,对时间进行空串对比

解决:只需要进行null值对比即可

33.Invalid bound statement (not found)

问题:MyBatis在尝试执行SQL语句时找不到对应的mapper

解决:检查命名空间是否一致,若一致还是找不到,删除对应的方法,重新创建即可 

34.基于API的越权访问

问题:系统无会话控制,导致低权限用户可直接通过URL访问高权限用户才能访问的系统模块,并得到与高权限用户一致的应答,人话【垂直越权,没有该菜单访问权限的账号,使用api工具访问到了】

解决:在逻辑里加了一层权限控制,多写了个菜单判断,按理说应该有公共方法,但是数据库权限表数据老是莫名其妙被清空,干脆就自己加了一层

本文章已经生成可运行项目
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值