I'm creating an Azure Function that downloads the XML of a given URL and stores the document in Cosmos DB at predefined times. Currently I develop the application locally in VSC with Java and also using the Cosmos DB Emulator. Within my code I instantiate a CosmosClient-object with the following code:
private static CosmosClient cosmosClient = new CosmosClientBuilder().endpoint("https://localhost:8081")
.key("C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==").consistencyLevel(ConsistencyLevel.EVENTUAL).buildClient();
Whenever I run my code the programm executs but after at the end of the buildClient() method a huge amount of threads are created leading to the following error message:
Terminal error message:
I took the URL and the key from the web surface of the emulator so where is my mistake? Do I have to provide additional credentials.
SOLVED: I made the mistake, that I added the Azure Cosmos Emulator certificate to the wrong java keystore as the Azure guide mentioned. My system variables only showed at my user version of the JVM, while I loaded the certificate to the global JVM copy, therefore resulting to a signature failure. A complete solution was provided in this post.