工作中遇到的异常(持续更新中。。。。)

    对于工作中出现的异常,特做记载,帮助自己记忆,也希望可以帮助到其他遇到相同问题的人。

1.com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    解决方案:没有连接上数据库,看是否是数据库的配置有问题。

2.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'loginController' method 

    解决方案:在使用requestMapping对controller命名时,出现了相同命名,检查是否有相同命名,对其进行修改即可。

3.java.lang.IllegalArgumentException: An invalid character [34] was present in the Cookie value

    解决方案:这是在保存Cookie时,Cookie只支持ASCII字符,而且不能有逗号、分号和空白。需要在保存时,进行转化,使用URLEncoder.encode(value,"utf-8")进行保存,使用URLDecoder.decode(name,"utf-8")进行解密。

4.java.sql.SQLException:null,message,fromserver:"Host'134.98.1.198 ' is not allowed to connect to this MySQL server" 

    解决方案:这是在连接数据库时存在问题,需要修改数据中mysql库中的user表,即可。

4.java.lang.IllegalArgumentException: bound must be positive。今天一直报这个错误,发现是应为使用Random.nextInt方法中时,传入的数值为负数所以报错,改成传正整数就可以了。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值