Home

解决Maven本地仓库有需要依赖的Maven插件但Nexus没有了对应的Maven插件报错的问题

问题描述 Failure to find org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.0 in http://myrepo:80/artifactory/repo was cached in the local repository, resolution will not be reattempted until the update interval of MyRepo has elapsed or updates are forced 解决方法 解决方法: 删掉对应插件的此文件,问题解决 http://stackoverflow.com/questions/4856307/when-maven-says-re...

Read more

解决Java使用HTTP代理报错java.io.IOException Unable to tunnel through proxy. Proxy returns HTTP 1.1 407 Proxy Authentication Required的问题

问题描述 java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" 问题原因 代理用户名密码使用Authenticator.setDefault设置的问题 解决方法 JDK 8u111版本后 默认将basic格式的鉴权禁止了 代码设置环境变量System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");打开basic格式 必须在HTTPURLConnection类初始化前 可以通过设置系统变量jdk.http.auth.tunneling....

Read more

解决Java URL中文参数 后台request接收乱码的问题

解决方法 1.可以考虑中间件编码配置 例如tomcat server.xml 的配置 eclipse的tomcat server 需要删掉再new一个,配置才生效 这个设置是影响URI中的字符编码,一般影响get请求的query string tomcat8后默认UTF-8,不需要另外设置 2.加上Spring的字符集filter 需确保该filter在最前面执行 注意Spring Security的filter一般会在最前面 Spring Security的CSRF检查会提早访问HttpServletRequest的参数,导致CharacterEncodingFilter失效 public class SecurityWebApplicationInitializer...

Read more

解决JUnit测试多线程,程序提前退出问题

问题描述 使用JUnit测试多线程问题,新打开的线程还没运行完成,整个进程就提前退出了 问题原因 JUnit运行环境中,假如主线程结束了,进程就会直接退出,不会等待其它线程完成 解决方法 通过一些方法阻塞主线程,等待其它线程执行完成,例如: System.in.read() Thread.sleep(5000) thread.join() countDownLatch.await()

Read more