2015年7月13日 星期一

連線SSL URL出現錯誤 unable to find valid certification path to requested target

參考:SunCertPathBuilderException: unable to find valid certification path to requested target
InstallCert.java

這狀況挺奇怪的,運作已經半年以上的突然出了以下Exception:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderExce
ption: unable to find valid certification path to requested target
        at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)
        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
java:1478)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav
a:212)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:957)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:892)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1050)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.
java:1363)

出問題的地方在於我要連結一個https的路徑取回資料,參考解法步驟如下:

  1. 將上述連結InstallCert.java 的檔案拿回來存成InstallCert.java
  2. 切換到存放InstallCert.java的路徑,使用javac編譯成.class
  3. cmd:java InstallCert [your target SSL domain]
    執行第一次的時候會有錯誤。再執行一次就可以(總共執行兩次)
  4. 將產生出來的jssecacerts檔案複製到 $JAVA_HOME/jre/lib/secirity
  5. restart your service(ex:tomcat)

2015年4月2日 星期四

再一次Mybatis出現 java.io.IOException: Could not find resource...使用Gradle

參考:
MyBatis loading XML : java.io.IOException: Could not find resource


又再一次出現了惱人的錯誤:
 java.io.IOException: Could not find resource...


這次的情況很詭異,使用eclipse  build的時候一切成功,但是一使用gradle build就出錯了,跟以前不同的是這次build tool改使用了gradle(之前使用ANT或根本沒用)

找到了以上的參考文章,以下的回答:


Note Since you have placed batisConfig.xml under src/main/java. By default maven configures to include only */*.java file( only java files) if need to include all the files you need to configure accordingly. But I would recommend to move the xml file to src/main/resources directory( which is again a classpath)

雖然我並非使用maven,但是其實是一樣的問題,原來預設於src/main/java下都只有include *.java,因此我只要將我的 mapper.xml 移動到 src/main/resources 就可以囉!

2015年3月1日 星期日

使用Android Sudio出現Empty region錯誤

今天第一次嘗試使用Android Studio, 沒多久就出現了詭異的錯誤:
 Empty region 

查了半天才知道原來是AndroidManifest.xml中的
   android:icon=@drawable/xxx 
其中的Resource xxx若是對應的為.ico則會出現此錯誤。 

但是很奇怪的是,雖然出現這錯誤,卻能正確的delpoy到手機上耶! !


p.s:好久沒發文...