2013-05-30 5 views
0

URL에서 XML을 읽으려고하면 SSLHandshakeException이 발생합니다. 이 줄에서 오류가 발생합니다. 문서 doc = db.parse (new InputSource (url.openStream()));URL에서 XML을 읽으려고하면 ssl.SSLHandshakeException이 발생합니다.

protected LinearLayout doInBackground(String... string) { 
     LinearLayout layout = new LinearLayout(DevicesActivity.this); 
     layout.setOrientation(1); 
     /** Create a new textview array to display the results */ 
     TextView device[]; 

     try { 
      URL url = new URL(); 
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
      DocumentBuilder db = dbf.newDocumentBuilder(); 
      Document doc = db.parse(new InputSource(url.openStream())); 
      doc.getDocumentElement().normalize(); 

로그 :

또한
05-30 15:18:21.742: I/Choreographer(12300): Skipped 59 frames! The application may be doing too much work on its main thread. 
05-30 15:18:22.305: I/ActivityManager(290): Displayed com.example.wip/.DevicesActivity: +2s340ms 
05-30 15:18:23.992: I/System.out(12300): XML Pasing Excpetion = javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 

나는 URL

the identity of this website has not been verified.• server's certificate is not trusted 

이 웹 사이트 서버의 문제의 페이지 정보를 볼하려고 할 때 크롬에서이 메시지를 받았습니다? 제 편으로 고칠 수 있을까요?

답변

1

문제는 서버 측에 있습니다. 잘못된 인증서를 사용하고 있습니다. (파이어 폭스에 따르면, 서버는 티켓 발급 사 체인을 포함하고 있지 않습니다. 이것은 자체 서명 된 인증서조차도 아니며 단지 잘못 구성된 것입니다.)

제 편으로 해결할 수 있습니까?

휴대 전화의 키 저장소에 신뢰할 수있는 인증서로 서버 인증서를 추가해야합니다. 그게 좋은 생각인지 모르겠다.

+0

감사합니다. 어떻게해야합니까? XML을 얻을 수 있는지 확인하려고합니다. – Michael

+0

Keytool 사용 - http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html –

+0

원하는 경우 XML을 사용하고 웹 브라우저를 사용하여 다운로드 한 다음 브라우저에 어쨌든 나쁜 인증서를 사용하십시오. 그러나 서버 *에는 * 사용자 이름과 암호가 필요합니다. –

관련 문제