I am getting below error while trying to connect astra through java driver . code is same as given in java doc
Path given for secure-connect bundle is correct and I have passed client id and client secret.
Please find the code
public class ConnectDatabase { public static void main(String[] args) { // Create the CqlSession object: try (CqlSession session = CqlSession.builder() .withCloudSecureConnectBundle(Paths.get("<</PATH/TO/>>secure-connect-books.zip")) .withAuthCredentials("<<CLIENT ID>>","<<CLIENT SECRET>>") .build()) { // Select the release_version from the system.local table: ResultSet rs = session.execute("select release_version from system.local"); Row row = rs.one(); //Print the results of the CQL query to the console: if (row != null) { System.out.println(row.getString("release_version")); } else { System.out.println("An error occurred."); } } System.exit(0); } }
Getting below error
Exception in thread "main" com.datastax.oss.driver.api.core.DriverExecutionException at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:152) at com.datastax.oss.driver.api.core.session.SessionBuilder.build(SessionBuilder.java:835) at com.booksrepo.betterreads.test.main(test.java:15) Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://1a8875b8-5b49-4c13-8c9d-21a7f7bbb37f-us-east-2.db.astra.datastax.com:29080/metadata at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1913) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:245) at com.datastax.oss.driver.internal.core.config.cloud.CloudConfigFactory.fetchProxyMetadata(CloudConfigFactory.java:232) at com.datastax.oss.driver.internal.core.config.cloud.CloudConfigFactory.createCloudConfig(CloudConfigFactory.java:133) at com.datastax.oss.driver.api.core.session.SessionBuilder.buildDefaultSessionAsync(SessionBuilder.java:876) at com.datastax.oss.driver.api.core.session.SessionBuilder.buildAsync(SessionBuilder.java:817) ... 2 more