JAVA 经常遇到一些问题【第二部分36~51】

27 篇文章 6 订阅 ¥9.90 ¥99.00
这篇博客整理了JAVA开发中遇到的36到51个问题,包括fastjson解析异常、符号无法解析、类型转换错误等,并提供了详细的解决方法。例如,针对fastjson错误,建议检查数据是否能重组为数组格式;无法解析符号时,检查POM文件、重启IDEA或删除.idea文件;ClassCastException则提示注意类型转换的正确性。此外,还涉及SpringBoot启动错误、企业微信API调用问题、数据库连接错误等,每个问题都给出了原因分析和解决策略。
摘要由CSDN通过智能技术生成

重拾者: 每日记录至目前(记录51种不同场景的问题可参考解决方案)

异常就两部分:
    1、excepiton信息: 报错产生的原因
    2、at开头表示: 异常产生的代码位置。 

欢迎关注微信公众号:AIMING2020

拆分两篇博客

        (第一部分1-35)地址如下:JAVA 经常遇到一些问题【第一部分1~35】

        (第一部分36-51)地址如下:JAVA 经常遇到一些问题【第二部分36~51】

问题1:Maven 项目中Cannot find declaration to go to或者运行报Java:程序 X.XXX 不存在 
问题2:修改maven 本地仓库和远程仓库
问题3:No archetype found in remote catalog. Defaulting to internal catalog
问题4:Package 'junit:junit' can be upgraded to version '4.13.2' 
问题5:Dependency 'org.seleniumhq.selenium:selenium-java:4.0.0' not found
问题6:Exception in thread "main" java.lang.NullPointerException(空指针异常
问题7:'Throwable' argument 'e.fillInStackTrace()' to 'System.out.println()' call 
问题8:Result of 'random.nextInt(target.length - 1)' is always '0' 
问题9:报错 Not a statement(不是声明)
问题10:新增java文件添加自动注释模版
问题11:为方法添加自动注释模版
问题12:Map 与HashMap  方法的用法以及结合replaceAll使用
问题13:①同一个类中文件调用方法,②不同类中调用方法
问题14:Collection 'paramMap.keySet()' is always empty 
问题15:Exception in thread "main" java.lang.NoSuchFieldError: XXX
问题16:The method XXX cannot be declared static; static methods can only be declared in a static or top level type
问题17:Unhandled exception type NoSuchProviderException
问题18:Mavan、Testng、junt                ①Maven 设置自定义仓库本地仓库 
问题19: 'XXX' is abstract; cannot be instantiated
问题20:Exception in thread "main" org.openqa.selenium.InvalidArgumentException: invalid argument  使用js 点击输入图片
问题21:email 发送问题归纳
        疑问①:Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587;
        疑问②:javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;  nested exception is:javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
        疑问③:javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
        疑问④:Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 587;
        疑问⑤:javax.mail.AuthenticationFailedException
        疑问⑥:com.sun.mail.smtp.SMTPSendFailedException: 503 Error: need EHLO and AUTH first !
        疑问⑦:javax.mail.AuthenticationFailedException: failed to connect, no password specified?
        疑问⑧: Unhandled exception type NoSuchProviderException
        疑问⑨:javax.mail.AuthenticationFailedException: 535 Login fail. Authorization code is expired 
问题22:Unhandled exception type NoSuchProviderException  
问题23:Log4j2报错并且没有生成log日志文件
问题24:非错误类,byte直接输出十进制,怎么输出二进制??
问题25:非错误类,方法中含byte数组参数如何输入调用??
问题26:com.fasterxml.jackson.core.JsonParseException:
问题27:pom.xml项目管理文件中结构
问题28:Exception in thread "main" com.alibaba.fastjson2.JSONException: unclosed
问题29:java.lang.StringIndexOutOfBoundsException: String index out of range: -1 
问题30:ElementNotInteractableException: Element XXXX could not be scrolled into view
问题31:在cmd中运行jar包出现 报错XXX.jar中没有主清单属性  怎么回事呢?
问题32:Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: X
问题33:运行jar包时 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
问题34:Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused: connect 
问题35:在postman 可以请求,但在httpcliect发起请求返回响应状态码400




实际目录

问题36:fastjson2.JSONException: offset X, character X, line X, column X

问题37:Cannot resolve symbol 'XXXXXX'

问题38:Exception in thread "main" java.lang.ClassCastException: com.testing.class10.Cat cannot be cast to

问题39:java.lang.IllegalArgumentException: Keys to send should be a not null CharSequence: 

问题40:org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed

问题41:'dependencies.dependency.version' for org.jetbrains:annotations:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 63, column 22 

问题42:'Missing management agent resource bundle: key = ""'

问题43:解决Springboot启动报错:类文件具有错误的版本61.0,应为 52.0

启动Springboot项目时候报错

原因

问题44:类文件具有错误的版本 55.0, 应为 52.0

问题45: Exception in thread "main" java.lang.UnsupportedOperationException

问题46: Exception in thread "main" java.lang.UnsupportedOperationException

问题47:调用企业微信响应报错:"errcode":60020

问题48:Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'controller' method 

问题49:java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup

问题50:java.lang.AbstractMethodError: love.forte.simbot.spring.autoconfigure.SimbotAppPropertiesConfiguration.registerBeanDefinitions 

问题51:连接数据库出现错误(windows更新8.XX版本以上)

疑问①:数据库连接配置失败,报错内容: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

疑问②:"main" java.lang.RuntimeException: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 

疑问③:java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AMING20220827

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值