Certificate Access Denied

package com.camunda.academy;

import java.security.cert.X509Certificate;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;

import com.camunda.academy.handler.CreditCardServiceHandler;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.worker.JobWorker;
import io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProvider;
import io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProviderBuilder;

import javax.net.ssl.*;

public class PaymentApplication {

	//Zeebe Client Credentials
	private static final String ZEEBE_ADDRESS = "zeebe-gateway-mcb-bpm-dev.cdedev.ocp-dev.mcb.local:443";
	private static final String ZEEBE_CLIENT_ID = "zeebe";
	private static final String ZEEBE_CLIENT_SECRET = "MKOHJON91g";
	private static final String ZEEBE_AUTHORIZATION_SERVER_URL = "https://auth-mcb-bpm-dev.apps.ocp-dev.mcb.local/auth/realms/camunda-platform/protocol/openid-connect/token";
	private static final String ZEEBE_TOKEN_AUDIENCE = "zeebe-api";


	//Payment Application Details
	private static final int WORKER_TIMEOUT = 10;
	private static final int WORKER_TIME_TO_LIVE = 10000;

	//Process Definition Details
	private static final String CREDIT_CARD_JOB_TYPE = "chargeCreditCard";
	private static final String BPMN_PROCESS_ID = "paymentProcess";

	//Process Variables
	private static final String VARIABLE_CARD_CVC = "cardCVC";
	private static final String VARIABLE_CARD_EXPIRY = "cardExpiry";
	private static final String VARIABLE_CARD_NUMBER = "cardNumber";
	private static final String VARIABLE_AMOUNT = "amount";
	private static final String VARIABLE_REFERENCE = "reference";

	public static void main(String[] args) throws Exception {

		final OAuthCredentialsProvider credentialsProvider =
				new OAuthCredentialsProviderBuilder()
						.authorizationServerUrl(ZEEBE_AUTHORIZATION_SERVER_URL)
						.audience(ZEEBE_TOKEN_AUDIENCE)
						.clientId(ZEEBE_CLIENT_ID)
						.clientSecret(ZEEBE_CLIENT_SECRET)
						.build();



		try (
				final ZeebeClient client =
						ZeebeClient.newClientBuilder()
								.caCertificatePath("src/main/resources/certificates")
								.gatewayAddress(ZEEBE_ADDRESS)
								.credentialsProvider(credentialsProvider)
								.build()) {

			{
				//Request the Cluster Topology
				System.out.println("Connected to: " + client.newTopologyRequest().send().join());

				//Build the Start Process Variables
				final Map<String, Object> variables = new HashMap<String, Object>();
				variables.put(VARIABLE_REFERENCE, "C8_12345");
				variables.put(VARIABLE_AMOUNT, Double.valueOf(100.00));
				variables.put(VARIABLE_CARD_NUMBER, "1234567812345678");
				variables.put(VARIABLE_CARD_EXPIRY, "12/2023");
				variables.put(VARIABLE_CARD_CVC, "123");

				//Launch the Process Instance
				client.newCreateInstanceCommand()
						.bpmnProcessId(BPMN_PROCESS_ID)
						.latestVersion()
						.variables(variables)
						.send()
						.join();

				//Start a Job Worker
				final JobWorker creditCardWorker =
						client.newWorker()
								.jobType(CREDIT_CARD_JOB_TYPE)
								.handler(new CreditCardServiceHandler())
								.timeout(Duration.ofSeconds(WORKER_TIMEOUT).toMillis())
								.open();

				//Wait for the Workers
				Thread.sleep(WORKER_TIME_TO_LIVE);
			}
//		} catch (Exception e) {
//		    e.printStackTrace();
//		}
		}
	}
}

Error :

"C:\Program Files\Java\jdk-21\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.2.4\lib\idea_rt.jar=64343:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.2.4\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Users\rhebhu\Downloads\c8-getting-started-microservice-orchestration-lab-solution 1\c8-getting-started-microservice-orchestration-lab-solution\target\classes;C:\Users\rhebhu\.m2\repository\io\camunda\zeebe-client-java\8.5.0\zeebe-client-java-8.5.0.jar;C:\Users\rhebhu\.m2\repository\io\camunda\zeebe-bpmn-model\8.5.0\zeebe-bpmn-model-8.5.0.jar;C:\Users\rhebhu\.m2\repository\org\camunda\bpm\model\camunda-xml-model\7.20.0\camunda-xml-model-7.20.0.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.17.2\jackson-core-2.17.2.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.17.2\jackson-datatype-jdk8-2.17.2.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.17.2\jackson-databind-2.17.2.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.17.2\jackson-annotations-2.17.2.jar;C:\Users\rhebhu\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\rhebhu\.m2\repository\org\apache\httpcomponents\core5\httpcore5\5.2.5\httpcore5-5.2.5.jar;C:\Users\rhebhu\.m2\repository\io\camunda\zeebe-gateway-protocol-impl\8.5.0\zeebe-gateway-protocol-impl-8.5.0.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-protobuf\1.62.2\grpc-protobuf-1.62.2.jar;C:\Users\rhebhu\.m2\repository\com\google\api\grpc\proto-google-common-protos\2.29.0\proto-google-common-protos-2.29.0.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-protobuf-lite\1.62.2\grpc-protobuf-lite-1.62.2.jar;C:\Users\rhebhu\.m2\repository\com\google\guava\guava\33.1.0-jre\guava-33.1.0-jre.jar;C:\Users\rhebhu\.m2\repository\com\google\guava\failureaccess\1.0.2\failureaccess-1.0.2.jar;C:\Users\rhebhu\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\rhebhu\.m2\repository\org\checkerframework\checker-qual\3.42.0\checker-qual-3.42.0.jar;C:\Users\rhebhu\.m2\repository\com\google\j2objc\j2objc-annotations\3.0.0\j2objc-annotations-3.0.0.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-stub\1.62.2\grpc-stub-1.62.2.jar;C:\Users\rhebhu\.m2\repository\com\google\errorprone\error_prone_annotations\2.23.0\error_prone_annotations-2.23.0.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-core\1.62.2\grpc-core-1.62.2.jar;C:\Users\rhebhu\.m2\repository\com\google\code\gson\gson\2.10.1\gson-2.10.1.jar;C:\Users\rhebhu\.m2\repository\com\google\android\annotations\4.1.1.4\annotations-4.1.1.4.jar;C:\Users\rhebhu\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.23\animal-sniffer-annotations-1.23.jar;C:\Users\rhebhu\.m2\repository\io\perfmark\perfmark-api\0.26.0\perfmark-api-0.26.0.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-context\1.62.2\grpc-context-1.62.2.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-api\1.62.2\grpc-api-1.62.2.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-netty\1.62.2\grpc-netty-1.62.2.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-codec-http2\4.1.111.Final\netty-codec-http2-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-codec-http\4.1.111.Final\netty-codec-http-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-handler-proxy\4.1.111.Final\netty-handler-proxy-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-codec-socks\4.1.111.Final\netty-codec-socks-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-transport-native-unix-common\4.1.111.Final\netty-transport-native-unix-common-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\grpc\grpc-util\1.62.2\grpc-util-1.62.2.jar;C:\Users\rhebhu\.m2\repository\com\google\protobuf\protobuf-java\3.25.3\protobuf-java-3.25.3.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-classes\2.0.65.Final\netty-tcnative-classes-2.0.65.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-linux-x86_64.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-linux-aarch_64.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-osx-x86_64.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-osx-aarch_64.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-tcnative-boringssl-static\2.0.65.Final\netty-tcnative-boringssl-static-2.0.65.Final-windows-x86_64.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-handler\4.1.111.Final\netty-handler-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-resolver\4.1.111.Final\netty-resolver-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-buffer\4.1.111.Final\netty-buffer-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-transport\4.1.111.Final\netty-transport-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-codec\4.1.111.Final\netty-codec-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\io\netty\netty-common\4.1.111.Final\netty-common-4.1.111.Final.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.17.2\jackson-dataformat-yaml-2.17.2.jar;C:\Users\rhebhu\.m2\repository\org\yaml\snakeyaml\2.2\snakeyaml-2.2.jar;C:\Users\rhebhu\.m2\repository\org\apache\httpcomponents\client5\httpclient5\5.2\httpclient5-5.2.jar;C:\Users\rhebhu\.m2\repository\org\apache\httpcomponents\core5\httpcore5-h2\5.2.5\httpcore5-h2-5.2.5.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-starter-web\3.3.2\spring-boot-starter-web-3.3.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-starter\3.3.2\spring-boot-starter-3.3.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot\3.3.2\spring-boot-3.3.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\3.3.2\spring-boot-autoconfigure-3.3.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-starter-logging\3.3.2\spring-boot-starter-logging-3.3.2.jar;C:\Users\rhebhu\.m2\repository\ch\qos\logback\logback-classic\1.5.6\logback-classic-1.5.6.jar;C:\Users\rhebhu\.m2\repository\ch\qos\logback\logback-core\1.5.6\logback-core-1.5.6.jar;C:\Users\rhebhu\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.23.1\log4j-to-slf4j-2.23.1.jar;C:\Users\rhebhu\.m2\repository\org\apache\logging\log4j\log4j-api\2.23.1\log4j-api-2.23.1.jar;C:\Users\rhebhu\.m2\repository\org\slf4j\jul-to-slf4j\2.0.13\jul-to-slf4j-2.0.13.jar;C:\Users\rhebhu\.m2\repository\jakarta\annotation\jakarta.annotation-api\2.1.1\jakarta.annotation-api-2.1.1.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-starter-json\3.3.2\spring-boot-starter-json-3.3.2.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.17.2\jackson-datatype-jsr310-2.17.2.jar;C:\Users\rhebhu\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.17.2\jackson-module-parameter-names-2.17.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\3.3.2\spring-boot-starter-tomcat-3.3.2.jar;C:\Users\rhebhu\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\10.1.26\tomcat-embed-core-10.1.26.jar;C:\Users\rhebhu\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\10.1.26\tomcat-embed-el-10.1.26.jar;C:\Users\rhebhu\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\10.1.26\tomcat-embed-websocket-10.1.26.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-web\6.1.11\spring-web-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-beans\6.1.11\spring-beans-6.1.11.jar;C:\Users\rhebhu\.m2\repository\io\micrometer\micrometer-observation\1.13.2\micrometer-observation-1.13.2.jar;C:\Users\rhebhu\.m2\repository\io\micrometer\micrometer-commons\1.13.2\micrometer-commons-1.13.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-webmvc\6.1.11\spring-webmvc-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-context\6.1.11\spring-context-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-expression\6.1.11\spring-expression-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-core\6.1.11\spring-core-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-jcl\6.1.11\spring-jcl-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\springframework\boot\spring-boot-starter-aop\3.3.2\spring-boot-starter-aop-3.3.2.jar;C:\Users\rhebhu\.m2\repository\org\springframework\spring-aop\6.1.11\spring-aop-6.1.11.jar;C:\Users\rhebhu\.m2\repository\org\aspectj\aspectjweaver\1.9.22.1\aspectjweaver-1.9.22.1.jar;C:\Users\rhebhu\.m2\repository\io\camunda\spring\spring-boot-starter-camunda\8.5.2\spring-boot-starter-camunda-8.5.2.jar;C:\Users\rhebhu\.m2\repository\io\camunda\spring\spring-client-zeebe\8.5.2\spring-client-zeebe-8.5.2.jar;C:\Users\rhebhu\.m2\repository\io\camunda\spring\spring-client-annotations\8.5.2\spring-client-annotations-8.5.2.jar;C:\Users\rhebhu\.m2\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;C:\Users\rhebhu\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\rhebhu\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\rhebhu\.m2\repository\io\camunda\spring\java-client-operate\8.5.2\java-client-operate-8.5.2.jar;C:\Users\rhebhu\.m2\repository\io\camunda\spring\java-common\8.5.2\java-common-8.5.2.jar;C:\Users\rhebhu\.m2\repository\io\github\resilience4j\resilience4j-retry\2.2.0\resilience4j-retry-2.2.0.jar;C:\Users\rhebhu\.m2\repository\io\github\resilience4j\resilience4j-core\2.2.0\resilience4j-core-2.2.0.jar;C:\Users\rhebhu\.m2\repository\io\camunda\spring\spring-client-common\8.5.2\spring-client-common-8.5.2.jar;C:\Users\rhebhu\.m2\repository\io\camunda\identity-spring-boot-autoconfigure\8.5.0\identity-spring-boot-autoconfigure-8.5.0.jar;C:\Users\rhebhu\.m2\repository\io\camunda\identity-sdk\8.5.0\identity-sdk-8.5.0.jar;C:\Users\rhebhu\.m2\repository\com\auth0\java-jwt\4.4.0\java-jwt-4.4.0.jar;C:\Users\rhebhu\.m2\repository\com\auth0\auth0\1.45.1\auth0-1.45.1.jar;C:\Users\rhebhu\.m2\repository\com\squareup\okhttp3\okhttp\4.12.0\okhttp-4.12.0.jar;C:\Users\rhebhu\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.9.24\kotlin-stdlib-jdk8-1.9.24.jar;C:\Users\rhebhu\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.9.24\kotlin-stdlib-1.9.24.jar;C:\Users\rhebhu\.m2\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar;C:\Users\rhebhu\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.9.24\kotlin-stdlib-jdk7-1.9.24.jar;C:\Users\rhebhu\.m2\repository\com\squareup\okio\okio\3.5.0\okio-3.5.0.jar;C:\Users\rhebhu\.m2\repository\com\squareup\okio\okio-jvm\3.5.0\okio-jvm-3.5.0.jar;C:\Users\rhebhu\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.9.24\kotlin-stdlib-common-1.9.24.jar;C:\Users\rhebhu\.m2\repository\com\squareup\okhttp3\logging-interceptor\4.12.0\logging-interceptor-4.12.0.jar;C:\Users\rhebhu\.m2\repository\net\jodah\failsafe\2.4.1\failsafe-2.4.1.jar;C:\Users\rhebhu\.m2\repository\com\auth0\jwks-rsa\0.22.1\jwks-rsa-0.22.1.jar;C:\Users\rhebhu\.m2\repository\org\apache\commons\commons-lang3\3.14.0\commons-lang3-3.14.0.jar;C:\Users\rhebhu\.m2\repository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar;C:\Users\rhebhu\.m2\repository\org\ehcache\ehcache\3.10.8\ehcache-3.10.8.jar;C:\Users\rhebhu\.m2\repository\javax\cache\cache-api\1.1.1\cache-api-1.1.1.jar;C:\Users\rhebhu\.m2\repository\org\slf4j\slf4j-api\2.0.13\slf4j-api-2.0.13.jar" com.camunda.academy.PaymentApplication
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: src\main\resources\certificates (Access is denied)
	at io.camunda.zeebe.client.impl.ZeebeClientImpl.configureConnectionSecurity(ZeebeClientImpl.java:221)
	at io.camunda.zeebe.client.impl.ZeebeClientImpl.buildChannel(ZeebeClientImpl.java:180)
	at io.camunda.zeebe.client.impl.ZeebeClientImpl.<init>(ZeebeClientImpl.java:112)
	at io.camunda.zeebe.client.impl.ZeebeClientBuilderImpl.build(ZeebeClientBuilderImpl.java:496)
	at com.camunda.academy.PaymentApplication.main(PaymentApplication.java:60)
Caused by: java.io.FileNotFoundException: src\main\resources\certificates (Access is denied)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:106)
	at io.camunda.zeebe.client.impl.ZeebeClientImpl.configureConnectionSecurity(ZeebeClientImpl.java:218)
	... 4 more

Process finished with exit code 1

Hi @RheaB, welcome to the forums! This looks like a local file system permissions issue. How are you running the project?