我想运行Java代码以使用Windows服务器中的代理读取Azure KeyVault。
我已经看过很多帖子,但是可以找到任何可行的解决方案。通常是为c#提供的,但我想要Java。我的代码在本地计算机上运行良好,但是当我尝试在需要设置代理的Pre-Prod Windows服务器中运行相同的代码时。
AuthenticationContext context = null;
AuthenticationResult result = null;
ExecutorService service = null;
try {
service = Executors.newFixedThreadPool(1);
context = new AuthenticationContext(authorization,false,service);
//added below 2 lines but don't see any effect
Proxy proxy = new Proxy(Proxy.Type.HTTP,new Inetsocketaddress("proxy.server.com",80));
context.setProxy(proxy);
ClientCredential credentials = new ClientCredential(clientId,clientKey);
Future<AuthenticationResult> future = context.acquireToken(
resource,credentials,null);
result = future.get();
当我在本地计算机上运行代码时,无论是否设置代理都可以正常运行,但是在该Windows服务器中会显示“未知主机”异常。