Running Spring Get-Started Demo with C8 Run (Connection refused: getsockopt)

Greetings,

I’m following this Get started as a Java developer using Spring guide but I am having hard time to make it work because of Connection refused: getsockopt error when trying to create a new process instance using:

        zeebeClient.newCreateInstanceCommand()
                .bpmnProcessId("process-payments")
                .latestVersion()
                .send()
                .join();

Notice:

  • Running Camunda 8 Run (Self-Managed) on Windows using the official guide.
  • Successfully deployed process definitions and ran process instances using the desktop modeler.
  • The spring boot demo is using version 3.5.0 with Java version 21.

I have:

  • Tried the completed demo provided by the guide but it failed with the same error.
  • Checked that he Zeebe Broker is accessible at localhost:8080 , and the Zeebe Gateway is accessible at localhost:26500:
PS C:\Windows\system32> Test-NetConnection -ComputerName localhost -Port 26500


ComputerName     : localhost
RemoteAddress    : ::1
RemotePort       : 26500
InterfaceAlias   : Loopback Pseudo-Interface 1
SourceAddress    : ::1
TcpTestSucceeded : True



PS C:\Windows\system32> Test-NetConnection -ComputerName localhost -Port 8080


ComputerName     : localhost
RemoteAddress    : ::1
RemotePort       : 8080
InterfaceAlias   : Loopback Pseudo-Interface 1
SourceAddress    : ::1
TcpTestSucceeded : True

Logs

 :: Spring Boot ::                (v3.5.0)

2025-06-16T11:31:12.415+03:00  INFO 21552 --- [           main] c.d.payment.PaymentProcessApplication    : Starting PaymentProcessApplication using Java 24 with PID 21552 (D:\Desktop\payment\target\classes started by Ahmad Al-Deeb in D:\Desktop\payment)
2025-06-16T11:31:12.421+03:00  INFO 21552 --- [           main] c.d.payment.PaymentProcessApplication    : No active profile set, falling back to 1 default profile: "default"
2025-06-16T11:31:15.049+03:00  INFO 21552 --- [           main] z.s.c.c.ZeebeClientProdAutoConfiguration : Creating ZeebeClient using ZeebeClientConfigurationImpl [ZeebeClientConfigurationImpl{camundaClientProperties=CamundaClientProperties{mode=selfManaged, tenantId='<default>', auth=AuthProperties{clientId='***', clientSecret='***', tokenUrl=http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token, credentialsCachePath='null', connectTimeout=null, readTimeout=null}, zeebe=ZeebeClientProperties{executionThreads=null, messageTimeToLive=null, maxMessageSize=null, maxMetadataSize=null, requestTimeout=null, caCertificatePath='null', keepAlive=null, overrideAuthority='null', defaults=ZeebeWorkerValue{type='null', name='null', timeout=null, maxJobsActive=null, requestTimeout=null, pollInterval=null, autoComplete=null, fetchVariables=null, enabled=null, methodInfo=null, tenantIds=null, forceFetchAllVariables=null, streamEnabled=null, streamTimeout=null, maxRetries=0}, override={}, preferRestOverGrpc=false, grpcAddress=http://127.0.0.1:26500, restAddress=https://jfk-1.zeebe.camunda.io/eae6d1c6-bcea-4821-9085-3b00cbc270c9} io.camunda.zeebe.spring.client.properties.common.ZeebeClientProperties@376e7531, cloud=CamundaClientCloudProperties{region='jfk-1', clusterId='eae6d1c6-bcea-4821-9085-3b00cbc270c9', baseUrl='null', port=null}}, jsonMapper=io.camunda.zeebe.client.impl.ZeebeObjectMapper@35fb22a9, interceptors=[], chainHandlers=[], zeebeClientExecutorService=io.camunda.zeebe.spring.client.jobhandling.ZeebeClientExecutorService@6c8909c3, credentialsProvider=io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProvider@1e008f36}]
2025-06-16T11:31:17.201+03:00  INFO 21552 --- [           main] c.d.payment.PaymentProcessApplication    : Started PaymentProcessApplication in 6.346 seconds (process running for 8.493)
2025-06-16T11:31:17.676+03:00  WARN 21552 --- [-worker-ELG-1-4] i.c.z.client.impl.ZeebeCallCredentials   : The request's security level does not guarantee that the credentials will be confidential.
2025-06-16T11:31:17.739+03:00  INFO 21552 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-06-16T11:31:17.759+03:00 ERROR 21552 --- [           main] o.s.boot.SpringApplication               : Application run failed

io.camunda.zeebe.client.api.command.ClientStatusException: null
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.transformExecutionException(ZeebeClientFutureImpl.java:116) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.join(ZeebeClientFutureImpl.java:54) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	at com.deeb.payment.PaymentProcessApplication.run(PaymentProcessApplication.java:31) ~[classes/:na]
	at org.springframework.boot.SpringApplication.lambda$callRunner$5(SpringApplication.java:789) ~[spring-boot-3.5.0.jar:3.5.0]
	at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82) ~[spring-core-6.2.7.jar:6.2.7]
	at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.2.7.jar:6.2.7]
	at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86) ~[spring-core-6.2.7.jar:6.2.7]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:797) ~[spring-boot-3.5.0.jar:3.5.0]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:788) ~[spring-boot-3.5.0.jar:3.5.0]
	at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:773) ~[spring-boot-3.5.0.jar:3.5.0]
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186) ~[na:na]
	at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:571) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560) ~[na:na]
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153) ~[na:na]
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:636) ~[na:na]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:773) ~[spring-boot-3.5.0.jar:3.5.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-3.5.0.jar:3.5.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1362) ~[spring-boot-3.5.0.jar:3.5.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1351) ~[spring-boot-3.5.0.jar:3.5.0]
	at com.deeb.payment.PaymentProcessApplication.main(PaymentProcessApplication.java:22) ~[classes/:na]
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: CANCELLED
	at java.base/java.util.concurrent.CompletableFuture.wrapInExecutionException(CompletableFuture.java:347) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:442) ~[na:na]
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2119) ~[na:na]
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.join(ZeebeClientFutureImpl.java:52) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	... 21 common frames omitted
Caused by: io.grpc.StatusRuntimeException: CANCELLED
	at io.grpc.Status.asRuntimeException(Status.java:532) ~[grpc-api-1.68.3.jar:1.68.3]
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481) ~[grpc-stub-1.68.3.jar:1.68.3]
	at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:489) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:453) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:486) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:564) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:729) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:710) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.68.3.jar:1.68.3]
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) ~[grpc-core-1.68.3.jar:1.68.3]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:1447) ~[na:na]
Caused by: java.net.ConnectException: Connection refused: getsockopt
	at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:628) ~[na:na]
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:533) ~[na:na]
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:583) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:665) ~[na:na]
	at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:161) ~[na:na]
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:516) ~[na:na]
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:604) ~[na:na]
	at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:274) ~[na:na]
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:380) ~[na:na]
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:393) ~[na:na]
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1029) ~[na:na]
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:962) ~[na:na]
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:898) ~[na:na]
	at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:871) ~[na:na]
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1162) ~[na:na]
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1126) ~[na:na]
	at io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProvider.fetchCredentials(OAuthCredentialsProvider.java:150) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	at io.camunda.zeebe.client.impl.oauth.OAuthCredentialsCache.computeIfMissingOrInvalid(OAuthCredentialsCache.java:123) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	at io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProvider.applyCredentials(OAuthCredentialsProvider.java:79) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	at io.camunda.zeebe.client.impl.ZeebeCallCredentials.lambda$applyRequestMetadata$0(ZeebeCallCredentials.java:49) ~[zeebe-client-java-8.7.5.jar:8.7.5]
	... 3 common frames omitted

Missing Info

This the simplified demo that produced the logs I provided.
Here is quick look at properties.yaml:

camunda:
  client:
    mode: self-managed
    zeebe:
      enabled: true
      grpc-address: http://127.0.0.1:26500
      rest-address: http://127.0.0.1:8080


Also, there is a some difference in the error of the completed demo by Camunda and you can find its logs here.

More Info

Camunda 8 Run Details:

Camunda Details:
  Version: 8.7.2
Java Details:
  Version: 21.0.3

More Trials

@MrDeeb - this sounds like it might be related to a local firewall perhaps? Your app is trying to make a gRPC call to Zeebe, so the first thing I would try is to bypass Spring/Java entirely and try with Postman (or similar tool). What response do you get from that? From there, we know if we are troubleshooting the Spring application (if it works) or C8 Run and local networking (if it fails with a similar error).

1 Like

Hi @nathan.loding ,

Well, I think the problem should be within Spring/Java since:

  • I was able to deploy process definitions using the desktop modeler.
  • I was able to start new process instances using the desktop modeler & Postman.

Which indicates I can communicate with Zeebe successfully outside Spring/Java.


Reproducing The Error

FYI, reproducing the error can be done easily by:

  1. Run C8 Run locally.
  2. Clone the demo repo: clone https://github.com/camunda/camunda-8-get-started-spring.git.
  3. Run the Spring Boot application.

Thank you for having a look. :pray:

Did you create your SpringBoot app into a Docker container?

1 Like

Hi @GotnOGuts ,

I used https://start.spring.io/ to create the SpringBoot app and also tried the completed demo by the guide.

I ran both locally on my machine using IntelliJ or by running the command mvn spring-boot:run (no docker is used).

Thank you.

:white_check_mark: Solved

The last PR #9 which upgraded spring-boot-starter-camunda-sdk to 8.6.0 broke the demo for some reason, so a quick solution is to use git to checkout before this PR.

But if you want to fix it manually without git:

  1. Downgrade spring-boot-starter-camunda-sdk in pom.xml from 8.6.0 to 8.5.0.
  2. Make security plaintext by adding the following in application.yml to avoid NotSslRecordException: not an SSL/TLS record error.
zeebe.client.security.plaintext: true

Thank you for looking into this. @nathan.loding @GotnOGuts

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.