-
Java学习路线(面试刷题)
我们的记忆力总是会随着时间慢慢忘记一些东西,就像是Java里面的引用一样,除了强引用其他的都可能慢慢忘记,只不过条件不一样罢了。所以学习和总结很重要,但是定期复习更加重要,所以不定时的看看,不仅仅能够巩固知识,也许还能够发现新的东西。##Java基础、进阶、全栈[https://github.com/CyC2018/CS-Notes](https://github.com/CyC2018/CS-Notes)[https://github.com/doocs/advanced-java](https://github.com/doocs/advanced-java)[https://github.com/Snailclimb/JavaGuide](https://github.com/Snailclimb/JavaGuide)##算法[https://github.com/labuladong/fucking-algorithm](https://github.com/labuladong/fucking-algorithm)[https://github.com/nonstriater/Learn-Algor...
Java 面试 学习路线 -
常见日志关闭
日志使用缓存系统关闭缓存里面的数据不能正常输出,需要我们手动关闭日志刷出缓存:##Log4j```javaLogManager.shutdown();```##Logback```javafinalLoggerContextcontext=(LoggerContext)LoggerFactory.getILoggerFactory();context.stop();```##SpringBoot```logging.level.root=OFF```
Logger -
sonatype登陆失败
怎么说呢,很久没有登陆了,然后今天升级JDK17提交了一个版本。先是证书过期了,搞了半天才发现证书过期了。然后发布时就是一直提示`401`。登陆网站一直提示密码账号密码错误,然后修改密码一直提示连接关闭。各种奇奇怪怪的提示,然后中午睡了一觉,起来发现居然啥问题没有了。估计应该是他们服务有问题。登陆失败:```Incorrectusername,passwordornopermissiontousetheNexusUserInterface.Tryagain.Pleaseloginbeforeattemptingfurtherrequests.```修改密码:```Thepasswordcouldnotbechangedbythecredentialsprovider.org.springframework.ldap.CommunicationException:connectionclosed;nestedexceptionisjavax.naming.CommunicationException:connectionclosed[Rootexceptionisjava.io.IOException:conn...
sonatype -
sonarqube JDK17启动失败
错误日志:```javawrapper|-->WrapperStartedasConsolewrapper|LaunchingaJVM...jvm1|Wrapper(Version3.2.3)http://wrapper.tanukisoftware.orgjvm1|Copyright1999-2006TanukiSoftware,Inc.AllRightsReserved.jvm1|jvm1|2021.09.1613:26:54INFOapp[][o.s.a.AppFileSystem]CleaningorcreatingtempdirectoryD:\develop\sonarqube-9.0.1.46107\tempjvm1|2021.09.1613:26:55INFOapp[][o.s.a.es.EsSettings]Elasticsearchlisteningon[HTTP:127.0.0.1:9001,TCP:127.0.0.1:1025]jvm1|2021.09.1613:26:55INFOapp[][o.s.a.ProcessLauncherImpl]Launchprocess[[key...
sonarqube JDK17 -
Maven打包gpg签名异常
错误原因:证书过期异常日志:```java[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign(auto-build-sign)onprojectsnail.parent:Exitcode:2->[Help1]org.apache.maven.lifecycle.LifecycleExecutionException:Failedtoexecutegoalorg.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign(auto-build-sign)onprojectsnail.parent:Exitcode:2atorg.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)atorg.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)atorg.apache.ma...
Maven -
获取不到POST表单请求参数
POST请求,设置请求内容`application/x-www-form-urlencoded`,后台获取不到请求参数。原来调用`request.getInputStream()`后再调用`request.getParameter()`就不能获取参数了。本来是想做一个兼容获取参数的方法,所以需要先调用`request.getParameterNames()`判断是否有参数判断是否调用`request.getParameter()`,再通过`request.getInputStream()`获取其他请求数据。
POST -
Eclipse彻底删除插件
Eclipse通过Uninstall卸载后还有些东西没有彻底删除:1.`eclipse\plugins`里面是否还有插件2.`eclipse\configuration\org.eclipse.osgi`里面是否还有配置(含有`.delete`就是已经删除插件配置)如果不确定文件是否属于删除的插件时不建议自行修改
Eclipse -
SpringBoot Ajax跨域请求sessionId
最经做一个功能时发现Ajax跨域并不能上送sessionId,每次请求sessionId都不一样,就是sessionId改变了,所以研究了一下。解决办法如下:添加SpringBoot跨域配置:```@ConfigurationclassWebConfigimplementsWebMvcConfigurer{@OverridepublicvoidaddCorsMappings(CorsRegistryregistry){registry.addMapping("/**").allowedOrigins("https://testjd.com:8080","https://testtaobao.com:8080").allowCredentials(true).allowedHeaders("*").allowedMethods("*").maxAge(1800);}}```Ajax添加Cookie配置withCredentials:```$.ajax({"xhrFields":{withCredentials:true},url:"https://testjd.com:8080",success:functio...
SpringBoot Ajax sessionId -
获取请求数据
做了一个获取请求数据的页面,发送请求到[https://www.acgist.com/demo/request](https://www.acgist.com/demo/request/print),然后访问[https://www.acgist.com/demo/request/print](https://www.acgist.com/demo/request/print),就可以拿到上次请求的数据了。主要包含数据:请求方法、请求头还有请求数据。
HTTP -
Java访问错误
```Thepackageorg.eclipse.core.runtimeisaccessiblefrommorethanonemodule:org.eclipse.core.contenttype,org.eclipse.core.jobs,org.eclipse.core.runtime,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registryThepackageorg.eclipse.core.runtimeisaccessiblefrommorethanonemodule:org.eclipse.core.contenttype,org.eclipse.core.jobs,org.eclipse.core.runtime,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registryIStatuscannotberesolvedtoatypeMultiStatuscannot...
Java -
Eclipse错误
今天升级了`Eclipse2021-06(4.20.0)`,默认就支持JDK16了,但是启动后发现提示错误:```javaCouldnotinitializeclassorg.apache.maven.plugin.war.util.WebappStructureSerializer```解决办法在Eclipse配置`eclipse.ini`中添加`--illegal-access=permit`重启就可以了。参考文章:[https://www.5axxw.com/questions/content/tts8j7](https://www.5axxw.com/questions/content/tts8j7)
Eclipse -
从零开始到下载世界:Tracker服务器和DHT网络
##如何获取下载客户端(Peer)将下载同一个资源的客户端视为Peer,开始下载的时候第一个任务就是获取Peer,越多越好,越优质越好。这时我们就需要从Tracker服务器和DHT网络中获取其他Peer。##什么是Tracker服务器Tracker服务器可以使用UDP/HTTP协议通过资源特征码(InfoHash)获取Peer的地址和端口。Tracker服务器很多时候都连接不上,所以使用优质的Tracker非常重要。[HTTPTracker](https://wiki.theory.org/index.php/BitTorrentSpecification)[代码实现](https://gitee.com/acgist/snail/blob/master/snail/src/main/java/com/acgist/snail/net/torrent/tracker/HttpTrackerSession.java)[UDPTracker](http://www.bittorrent.org/beps/bep_0015.html)[代码实现](https://gitee.com/acgist/snail/blo...
Tracker DHT -
从零开始到下载世界:种子文件
##种子文件作用种子文件主要用来描述文件信息:文件名称、大小、校验,还有如何获取下载客户端的Tracker服务器[从零开始到下载世界](https://www.acgist.com/article/588.html)
种子文件 -
从零开始到下载世界:BT入门
##什么是BT?简单一点来说就是P2P文件传输协议,就是用户和用户之间进行文件分享。用户下载的同时会向其他用户上传已经下载的数据,所以和FTP、HTTP这些协议相比,下载(分享)越多下载越快。详细参见:[BitTorrent](https://baike.baidu.com/item/BitTorrent/142795)##如何实现BT协议?BT协议里面其实包含很多协议,这些协议你可以在[BitTorrent.org](http://bittorrent.org/beps/bep_0000.html)查看。这里面有非常多的协议,这些协议有不同的状态:最终、接收、草稿、废弃。当然这些协议不是需要全部实现,可以选择实现必须的协议即可,还可以自定义协议。查看[蜗牛实现协议](https://gitee.com/acgist/snail/blob/master/docs/PROTOCOL.md)后面基本上会按照[BitTorrent.org](http://bittorrent.org/beps/bep_0000.html)里面的协议顺序进行逐个讲解如何实现BT协议。[从零开始到下载世界](https://www.a...
BT BitTorrent -
手机摄像头应用
[调用摄像头拍照](//www.acgist.com/demo/photo/index.html):调用摄像头直接拍照[调用摄像头获取人脸数据](//www.acgist.com/demo/face/index.html):调用摄像头连续获取几组人脸数据(前置摄像头)**注意:摄像头调用需要使用https协议,http测试只能使用localhost,不能使用IP地址。**
HTML5 摄像头 -
Java性能分析工具
jconsole:JDK自带监控一些GC、内存、线程、CPU等等信息。jvisualvm:JDK1.8以前自带功能和jconsole差不多,但是显示更加丰富。jmc:JDK1.8以前自带下载地址:[https://jdk.java.net/jmc/](https://jdk.java.net/jmc/)或者使用:[https://www.oracle.com/java/technologies/javase/products-jmc8-downloads.html](https://www.oracle.com/java/technologies/javase/products-jmc8-downloads.html)更加丰富的监控内容,推荐使用。此外还有一些常用命令:jps、jcmd、jmap、pmap、jinfo、jstack、valgrind、gperftools等等```jpsjcmdpidnamejmap-histo:livepidpmappidjinfopidjstackpid```##jcmd参数```Compiler.CodeHeap_AnalyticsCompiler.codecacheCo...
Java -
Apache Base64工具注意事项
主要就是两种写法:```javaBase64.encodeBase64String(byte[])newString(Base64.encodeBase64(byte[]))```主要问题就是上面写法会有换行符,下面没有换行符。
Apache Base64 -
Shiro和SpringBoot导致@Cacheable失效
使用`shiro-spring-boot-starter`做权限控制,但是发现导致`@Cacheable`失效了。这时需要添加配置:```java@BeanpublicDefaultAdvisorAutoProxyCreatordefaultAdvisorAutoProxyCreator(){DefaultAdvisorAutoProxyCreatordefaultAdvisorAutoProxyCreator=newDefaultAdvisorAutoProxyCreator();defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);//defaultAdvisorAutoProxyCreator.setUsePrefix(true);returndefaultAdvisorAutoProxyCreator;}```或者直接添加配置:```javaspring.aop.proxy-target-class=true```还有一个问题也能使用这个解决:```javaorg.springframework.beans.factory.Unsatisfi...
Shiro SpringBoot @Cacheable -
shields动态生成Git项目徽章
项目地址:[https://shields.io/](https://shields.io/)之前都是用的shields提供的一些build、version这些,但是码云就用不了。本来今天想要重新做一个的,但是发现原来还可以动态生成。格式:```https://img.shields.io/badge/dynamic/json?url=&label=&query=<$.DATA.SUBDATA>&color=&prefix=&suffix=https://img.shields.io/badge/dynamic/xml?url=&label=&query=&color=&prefix=&suffix=https://img.shields.io/badge/dynamic/yaml?url=&label=&query=<$.DATA.SUBDATA>&color=&prefix=&suffix=```比如码云stars:```https://img.shields.i...
shields github gitee -
软件URL Scheme
####微信URLScheme[https://www.zhihu.com/question/30616809](https://www.zhihu.com/question/30616809)####支付宝URLScheme[https://www.jianshu.com/p/ebaedd551365](https://www.jianshu.com/p/ebaedd551365)[https://ld246.com/article/1596449463334](https://ld246.com/article/1596449463334)
URL Scheme