重拾者: 每日记录至目前(记录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'
问题39:java.lang.IllegalArgumentException: Keys to send should be a not null CharSequence:
问题40:org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed
问题42:'Missing management agent resource bundle: key = ""'
问题43:解决Springboot启动报错:类文件具有错误的版本61.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
问题51:连接数据库出现错误(windows更新8.XX版本以上)
疑问③:java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed