0

I am working on Azure Databricks Test Automation using Java. There are a number of Jobs and pipelines that are created in Azure Databricks to process data. I want to create WorkspaceClient for them and validate the functionality and logs. I am behind a corporate proxy and on running my Java code, I am getting Unknown host/ Connection Timeout error.

Here is my Java code:

public static WorkspaceClient getWorkspaceClient() throws Exception {
    
    System.setProperty("http.proxyHost", "xyz.com");
    System.setProperty("http.proxyPort", "8888");
    System.setProperty("https.proxyHost", "xyz.com");
    System.setProperty("https.proxyPort", "8888");
    
    DatabricksConfig cfg = new DatabricksConfig()
             .setHost("https://...")

             .setToken("xxx");
                  
    WorkspaceClient w = new WorkspaceClient(cfg);
    
    
    System.out.println("#Jobs: " + w.jobs().list(null));

The proxy is not getting picked up/resolved and I am getting the below error:

20:41:29.105 [main] WARN com.databricks.sdk.core.DefaultCredentialsProvider -- Failed to get OpenID Connect endpoints
    com.databricks.sdk.core.DatabricksException: Request GET /oidc/.well-known/oauth-authorization-server failed after 4 retries
        at com.databricks.sdk.core.ApiClient.executeInner(ApiClient.java:261)
        at com.databricks.sdk.core.ApiClient.execute(ApiClient.java:204)
        at com.databricks.sdk.core.ApiClient.execute(ApiClient.java:191)
        at com.databricks.sdk.core.DatabricksConfig.fetchDefaultOidcEndpoints(DatabricksConfig.java:666)
        at com.databricks.sdk.core.DatabricksConfig.getOidcEndpoints(DatabricksConfig.java:622)
        at com.databricks.sdk.core.DefaultCredentialsProvider.addOIDCCredentialsProviders(DefaultCredentialsProvider.java:101)
        at com.databricks.sdk.core.DefaultCredentialsProvider.addDefaultCredentialsProviders(DefaultCredentialsProvider.java:164)
        at com.databricks.sdk.core.DefaultCredentialsProvider.configure(DefaultCredentialsProvider.java:60)
        at com.databricks.sdk.core.DatabricksConfig.getTokenSource(DatabricksConfig.java:223)
        at com.databricks.sdk.service.serving.ServingEndpointsDataPlaneImpl.<init>(ServingEndpointsDataPlaneImpl.java:31)
        at com.databricks.sdk.service.serving.ServingEndpointsDataPlaneAPI.<init>(ServingEndpointsDataPlaneAPI.java:23)
        at com.databricks.sdk.WorkspaceClient.<init>(WorkspaceClient.java:445)
        at com.amdocs.di.testing.steps.tests.demo.DatabricksWConfig.getWorkspaceClient(DatabricksWConfig.java:43)
        at com.amdocs.di.testing.steps.tests.demo.TestDatabricksJDBCConnection.testWF(TestDatabricksJDBCConnection.java:77)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
        at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:686)
        at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
        at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
        at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
        at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
        at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
        at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testng.TestRunner.privateRun(TestRunner.java:739)
        at org.testng.TestRunner.run(TestRunner.java:614)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
        at org.testng.SuiteRunner.run(SuiteRunner.java:312)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
        at org.testng.TestNG.runSuites(TestNG.java:1112)
        at org.testng.TestNG.run(TestNG.java:1079)
        at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
        at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)
    Caused by: com.databricks.sdk.core.DatabricksError: xxxxxxxxx
        at com.databricks.sdk.core.error.ApiErrors.getDatabricksError(ApiErrors.java:23)
        at com.databricks.sdk.core.ApiClient.executeInner(ApiClient.java:255)
        ... 40 common frames omitted
    Caused by: java.net.UnknownHostException: xxxxxxxxxxxxxxxxxxxx

1 Answer 1

0
  • The java sdk for databricks doesn’t automatically respect http(s).proxyHost system properties for its internal http client, you need to explicitly set the proxy in the DatabricksConfig via .setProxyHost() and .setProxyPort() or use a custom HttpClient injected into the sdk that’s proxy-aware. otherwise all your system property settings get ignored.

  • corporate proxies often require ssl interception and custom truststores. if your proxy rewrites certificates, you’ll need to add the proxy’s root cert to your java truststore ($JAVA_HOME/lib/security/cacerts) and point -Djavax.net.ssl.trustStore to it, or every https call will silently fail with unknown host / timeout errors even if the dns is fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.