簡體   English   中英

谷歌 OAUTH: java.lang.NoClassDefFoundError: javax/net/ssl/HttpsURLConnection

[英]Google OAUTH: java.lang.NoClassDefFoundError: javax/net/ssl/HttpsURLConnection

我正在嘗試使用 goolge-oauth2 庫,當我在 class 上調用刷新令牌方法時出現此錯誤:

造成的:

java.lang.NoClassDefFoundError: javax/net/ssl/HttpsURLConnection
        at com.google.api.client.http.javanet.NetHttpTransport.buildRequest(NetHttpTransport.java:152)
        at com.google.api.client.http.javanet.NetHttpTransport.buildRequest(NetHttpTransport.java:55)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:889)
        at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:441)
        at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:157)
        at com.google.auth.oauth2.OAuth2Credentials.refreshIfExpired(OAuth2Credentials.java:174)

這是我用來檢索 ServiceAccountCredentials object 的代碼

ServiceAccountCredentials googleCredential = ServiceAccountCredentials.fromPkcs8(client_id, client_email, private_key,private_key_id, Arrays.asList(scope));
googleCredential.refreshIfExpired();

使用“https://www.googleapis.com/auth/iam”作為 scope

現在這是我第一次需要連接到 Https url 所以也許我錯過了一些東西......

https://www.eclipse.org/forums/index.php/t/1072090/說您需要在清單中導入 javax.net.ZF9D5C16A7F42203F8C195432354A 我不是 OSGi 開發人員,所以我不確定它到底是如何工作的,但找到這方面的文檔應該不會太難。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM