使用java在azure表中需要代理身份验证

时间:2014-06-11 06:27:38

标签: java eclipse azure azure-storage azure-table-storage

我需要使用java访问azure云表。我的互联网在代理之后工作,需要认证。我在互联网上搜索并发现了这个 -

System.setProperty("http.proxyHost", "172.16.2.1");
System.setProperty("http.proxyPort", "3128");
System.setProperty("http.proxyUser", "username");
System.setProperty("http.proxyPassword", "password");

但它会出现以下错误,

Azure存储客户端库示例TableBasics开始... 运行样本时有例外。例外细节: com.microsoft.windowsazure.services.core.storage.StorageException:服务器遇到未知故障:需要代理身份验证     在com.microsoft.windowsazure.services.core.storage.StorageException.translateException(StorageException.java:129)     在com.microsoft.windowsazure.services.core.storage.utils.implementation.StorageOperation.materializeException(StorageOperation.java:158)     在com.microsoft.windowsazure.services.core.storage.utils.implementation.ExecutionEngine.executeWithRetry(ExecutionEngine.java:142)     在com.microsoft.windowsazure.services.table.client.QueryTableOperation.performRetrieve(QueryTableOperation.java:218)     在com.microsoft.windowsazure.services.table.client.TableOperation.execute(TableOperation.java:562)     在com.microsoft.windowsazure.services.table.client.CloudTableClient.execute(CloudTableClient.java:262)     在com.microsoft.windowsazure.services.table.client.CloudTable.exists(CloudTable.java:416)     在com.microsoft.windowsazure.services.table.client.CloudTable.createIfNotExist(CloudTable.java:223)     在com.microsoft.windowsazure.services.table.client.CloudTable.createIfNotExist(CloudTable.java:186)     在test1.TableBasics.main(TableBasics.java:63)

Azure存储客户端库示例TableBasics已完成。

1 个答案:

答案 0 :(得分:0)

使用" https"而不是" http"代理系统属性的用户和代理密码

System.setProperty("http.proxyHost", "172.16.2.1");
System.setProperty("http.proxyPort", "3128");
System.setProperty("http.proxyUser", "username");
System.setProperty("http.proxyPassword", "password");

而不是

System.setProperty("http.proxyHost", "172.16.2.1");
System.setProperty("http.proxyPort", "3128");
System.setProperty("https.proxyUser", "username"); // if domain name applicable then System.setProperty("https.proxyUser", "domain\\username");
System.setProperty("https.proxyPassword", "password");