클라이언트 응용 프로그램을 개발하려면 워크 시트와 데이터를 읽고 수정해야합니다 (Google Sheets
). 나는 아래의 문제에 직면하고있다 :API를 사용하여 Google 스프레드 시트에서 UnknownHostException 오류를 해결하는 방법은 무엇입니까?
SpreadsheetService service = new SpreadsheetService("sheet1");
String sheetUrl = "https://spreadsheets.google.com/feeds/list/1XP3KQTboWCArbvH99XYEGsVOldc97NqFzKD MiEepXRA/default/public/values"; //Sheet url
URL url = new URL(sheetUrl); // Get Feed of Spreadsheet url
ListFeed lf = service.getFeed(url, ListFeed.class); //Error statement
문제 :
java.net.UnknownHostException : spreadsheets.google.com를 java.net.AbstractPlainSocketImpl.connect (알 수없는 소스)에서 자바에서. net.PlainSocketImpl.connect (알 수없는 소스)에서 에서 java.net.SocksSocketImpl.connect (알 수없는 소스) 에서 java.net.Socket.connect (알 수없는 소스) sun.security.ssl.SSLSocketImpl.connect (알 수없는 소스) at sun.security.ssl.BaseSSLSocketImpl.connect (알 수없는 S ource) at sun.net.www.http.HttpClient.openServer (알 수없는 출처) sun.net.www.http.HttpClient.openServer (알 수없는 출처) at sun.net.NetworkClient.doConnect (알 수없는 출처) at sun.net.www.protocol.https.HttpsClient (알 수없는 출처) sun.net.www.protocol.https.HttpsClient.New (알 수없는 출처) sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection. getNewHttpClient 일에서 sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect에서 sun.net.www.protocol.http.HttpURLConnection.plainConnect (알 소스) (알 소스)에서 (알 소스). net.www.protocol.https.HttpsURLConnectionImpl.conn com.google.gdata.client.http.GoogleGDataRequest.execute에서 com.google.gdata.client.http.HttpGDataRequest.execute (HttpGDataRequest.java:503) (GoogleGDataRequest.java:535에 요법 (알 소스)) at com.google.gdata.client.Service.getFeed (Service.java:1135) com.google.gdata.client.Service.getFeed (Service.java:998) com.google.gdata.client test_project.test_demo.main에서 com.google.gdata.client.Service.getFeed (Service.java:1017)에서 .GoogleService.getFeed (GoogleService.java:631) (test_demo.java:35)
알 수없는 호스트는 일반적으로 URL이 잘못되었다는 것을 의미합니다 ... 그게 단지 sheets.google.com이나 다른 것이 아니라고 확신합니까? –
중복이 아닐 수도 있습니다. 귀하의 프로젝트 자바 7 또는 8인가요? java 8의 경우 기본 appengine-web.xml 설정은 청구가 사용 설정되지 않은 경우 해당 예외를 발생시킬 수 있습니다. url-stream-handler를 https://cloud.google.com/appengine/docs/standard/java/config/appref에서 확인하십시오. –