NoSuchElementException when executing a custom connector

Hi there,
I created my very first and useful connector that does a string concatenation, following the great connector sdk documentation

Here you are my connector: concatenationConnector

I’m using a Pre-packaged runtime environment, I run the runtime embedding the connector as explained in the doc in this way:

java -cp 'connector-runtime-job-worker-with-depdencies.jar;concatenation-connector-with-dependencies.jar' \
    io.camunda.connector.runtime.jobworker.Main

The connector is registered correctly:

Oct 18, 2022 1:27:08 PM io.camunda.connector.runtime.jobworker.Main lambda$main$0
INFO: Registering outbound connector OutboundConnectorRegistration { name=concatenation-connector, type=io.camunda:concatenation-api:1, function=io.camunda.connector.ConcatenationConnectorFunction, inputVariables=[input1, input2] }

But as soon as I start a process instance providing proper inputs, and the connector is invoked, I get the following error:

Oct 18, 2022 2:53:21 PM io.camunda.connector.runtime.util.outbound.ConnectorJobHandler handle
INFO: Received job 4503599628339500
Oct 18, 2022 2:53:21 PM io.camunda.connector.runtime.util.outbound.ConnectorJobHandler handle
SEVERE: Failed to process job 4503599628339500
java.util.NoSuchElementException
        at java.base/java.util.ServiceLoader$2.next(ServiceLoader.java:1318)
        at java.base/java.util.ServiceLoader$2.next(ServiceLoader.java:1306)
        at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
        at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.getSecretProvider(ConnectorJobHandler.java:77)
        at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:54)
        at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44)
        at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

Oct 18, 2022 2:53:21 PM io.camunda.zeebe.client.impl.worker.JobRunnableFactory executeJob
WARNING: Worker concatenation-connector failed to handle job with key 4503599628339500 of type io.camunda:concatenation-api:1, sending fail command to broker
java.lang.NullPointerException
        at io.camunda.zeebe.gateway.protocol.GatewayOuterClass$FailJobRequest$Builder.setErrorMessage(GatewayOuterClass.java:22512)
        at io.camunda.zeebe.client.impl.command.FailJobCommandImpl.errorMessage(FailJobCommandImpl.java:67)
        at io.camunda.connector.runtime.util.outbound.ConnectorJobHandler.handle(ConnectorJobHandler.java:68)
        at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44)
        at io.camunda.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

What am I doing wrong here?
Thanks!
Enrico

Hi @Enrico,

excited to see you’re giving this a try!

It looks like the runtime tries to load a SecretProvider although there is none in the environment.
I’ll give this a quick try locally and see if I can reproduce this.

Could you detail which version of the runtime you used and where you got it from?
Also, which OS are you executing this on?

Best,
Tobias

Hi @tmetzke ,
I am excited as well to try this exciting feature out!
I’m using a mac, and I built the runtime jar from the main in

Thanks in advance!

Thanks for the details, @Enrico!

Can you please give it a try using the provided JAR with deps at Maven Central?

Feel free to follow the (already updated but not yet released) manual installation guide here:

General installation details can be found at the Connectors installation guide for Self-Managed:

Note that on MacOS you probably need to use a : instead of a ; for separating classpath elements when running the Java command.

Let me know if this helps.

1 Like

It works perfectly! Thank you very much!

Great to hear, @Enrico :slight_smile:
I actually think it’s rather due to the : than the runtime you used.
Maybe you can give it a try to confirm that?

Since I’m on Mac I’m using the zsh. So I need to use the “:” separator.
When I reported the issue I was already using the “:” separator also if I wrote “;” (probably I did a copy and paste from the documentation). Sorry for the confusion.

If I’m using the “;” I can’t even start the runtime:

Error: Could not find or load main class io.camunda.connector.runtime.jobworker.Main
Caused by: java.lang.ClassNotFoundException: io.camunda.connector.runtime.jobworker.Main

OK, makes sense, thanks, @Enrico :+1:
I will have a look at why the current SNAPSHOT version fails when you build and use that for Connector execution :slight_smile:

1 Like

I actually couldn’t reproduce this in any way locally. Let’s keep an eye on this.
@Enrico, if you encounter this again with the next release, please create a bug report in our repository. Might have also been due to an intermediate state of the local copy of the repository, maybe.

Hi,

I had exactly the same issue today and I am glad you saved my day in the end with the temp solution to download the jar from here:

https://search.maven.org/remotecontent?filepath=io/camunda/connector/connector-runtime-job-worker/0.2.2/connector-runtime-job-worker-0.2.2-with-dependencies.jar

Regards,

Maarten

With Connector SDK 0.3.0, Spring Zeebe becomes the default Connector Runtime.

You can find more resources on runtimes in our user guide:

2 Likes