Unable create an object in Custom outbound connector docker runtime

I’m trying to run an outbound connector in docker using self-managed version with necessity of a credential object to be configured at the start of application
Dockerfile in the application goes like this

FROM camunda/connectors:0.21.3
COPY target/example-0.0.1-SNAPSHOT.jar /opt/app/
ENTRYPOINT ["/start.sh"]

Compose file is

services:
  test-connector:
    image: test-connector:latest
    container_name: testConnector

    environment:
      - ZEEBE_CLIENT_BROKER_GATEWAY-ADDRESS=zeebe:26500
      - ZEEBE_CLIENT_SECURITY_PLAINTEXT=true
      - CAMUNDA_CONNECTOR_POLLING_ENABLED=false
      - CAMUNDA_CONNECTOR_WEBHOOK_ENABLED=false
      - SPRING_MAIN_WEB-APPLICATION-TYPE=none
      - OPERATE_CLIENT_ENABLED=false
  
    networks:
      - camunda-platform-828_camunda-platform
    volumes:
      - type: bind
        source: xxxxx
        target: xxxxx
networks:
  camunda-platform-828_camunda-platform:
    external: true  

During runtime it is unable to create the credential object in side the @OutboundConnector class
so i have created a custom runtime environment with the help of this docs

The custom connector code is

public class Main {
  public static Object object;// credential object 
  static {
   //code to configure credetial object using the volume mount file
   }

  public static void main(String[] args) {

    var zeebeClient = ZeebeClient.newClientBuilder().build();

    zeebeClient.newWorker()
        .jobType("io.camunda:template:1")
        .handler(new ConnectorJobHandler(new MyConnectorFunction()))
        .name("MESSAGE")
        .fetchVariables("authentication", "message")
        .open();
  }
}

Im trying to acces the credential object in the @OutboundConnector class like this

@OutboundConnector(
    name = "MYCONNECTOR",
    inputVariables = {"myProperty", "authentication"},
    type = "io.camunda:template:1"
)
public class MyConnectorFunction implements OutboundConnectorFunction {

  private static final Logger LOGGER = LoggerFactory.getLogger(MyConnectorFunction.class);

  @Override
  public Object execute(OutboundConnectorContext context) throws Exception {
    
    var connectorRequest = context.getVariablesAsType(MyConnectorRequest.class);

    String message = executeConnector(connectorRequest,Main.Object);//the static credential object from main class
  

The connector is running but when I try to access the object after invoking the connector it is giving as null and not moving further because it’s needed

I have tried the same app with the Spring boot connector Runtime locally its working fine but, I want to build the runtime in docker

Is there anything i’m missing or any alternate approach is there
@igpetrov, @jwulf , @Niall , @nathan.loding please help with this

Hi @Praveen_Kumar_Reddy - unfortunately this isn’t something I’m very familiar with, and I’m not sure I understand the need/use of the credential object. Because it’s a static object, I am assuming the credentials do not change while the container is running. Can you provide the object to your Connector via the constructor rather than trying to access a static property?

.handle(new ConnectorJobHandler(new MyConnectorFunction(credentialObject))

Hi @nathan.loding
Thanks for your reply
I have tried providing the credential object in the constructor of connector function as mentioned

.handle(new ConnectorJobHandler(new MyConnectorFunction(credentialObject))

even though the object doesn’t change the class MyConnectorFunction will be unable to create the constructor with object as a parameter during runtime and it is throwing

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.core.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception with message: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xx.xx.CredentialObject  Unable to get public no-arg constructor
2023-07-20 09:33:12     at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
2023-07-20 09:33:12     ... 63 common frames omitted
2023-07-20 09:33:12 Caused by: java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xx.xx.CredentialObject  Unable to get public no-arg constructor
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader.fail(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader.getConstructor(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader$2.hasNext(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader$ProviderSpliterator.tryAdvance(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.Spliterator.forEachRemaining(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
2023-07-20 09:33:12     at io.camunda.connector.runtime.core.discovery.SPIConnectorDiscovery.discoverOutbound(SPIConnectorDiscovery.java:38)
2023-07-20 09:33:12     at io.camunda.connector.runtime.core.outbound.DefaultOutboundConnectorFactory.loadConnectorConfigurations(DefaultOutboundConnectorFactory.java:91)
2023-07-20 09:33:12     at io.camunda.connector.runtime.core.outbound.DefaultOutboundConnectorFactory.<init>(DefaultOutboundConnectorFactory.java:42)
2023-07-20 09:33:12     at io.camunda.connector.runtime.outbound.OutboundConnectorRuntimeConfiguration.outboundConnectorFactory(OutboundConnectorRuntimeConfiguration.java:38)
2023-07-20 09:33:12     at io.camunda.connector.runtime.outbound.OutboundConnectorRuntimeConfiguration$$SpringCGLIB$$0.CGLIB$outboundConnectorFactory$1(<generated>)
2023-07-20 09:33:12     at io.camunda.connector.runtime.outbound.OutboundConnectorRuntimeConfiguration$$SpringCGLIB$$2.invoke(<generated>)
2023-07-20 09:33:12     at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258)
2023-07-20 09:33:12     at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
2023-07-20 09:33:12     at io.camunda.connector.runtime.outbound.OutboundConnectorRuntimeConfiguration$$SpringCGLIB$$0.outboundConnectorFactory(<generated>)
2023-07-20 09:33:12     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-07-20 09:33:12     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2023-07-20 09:33:12     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2023-07-20 09:33:12     at java.base/java.lang.reflect.Method.invoke(Unknown Source)
2023-07-20 09:33:12     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
2023-07-20 09:33:12     ... 64 common frames omitted
2023-07-20 09:33:12 Caused by: java.lang.NoClassDefFoundError: com.xx.xx.CredentialObject
2023-07-20 09:33:12     at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
2023-07-20 09:33:12     at java.base/java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
2023-07-20 09:33:12     at java.base/java.lang.Class.getConstructor0(Unknown Source)
2023-07-20 09:33:12     at java.base/java.lang.Class.getConstructor(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader$1.run(Unknown Source)
2023-07-20 09:33:12     at java.base/java.util.ServiceLoader$1.run(Unknown Source)
2023-07-20 09:33:12     at java.base/java.security.AccessController.doPrivileged(Unknown Source)
2023-07-20 09:33:12     ... 89 common frames omitted
2023-07-20 09:33:12 Caused by: java.lang.ClassNotFoundException: com.xx.xx.CredentialObject
2023-07-20 09:33:12     at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
2023-07-20 09:33:12     at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
2023-07-20 09:33:12     at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
2023-07-20 09:33:12     ... 96 common frames omitted
2023-07-20 09:33:12

Your view on this @Niall, @Ingo_Richtsmeier, @jwulf, @igpetrov , @nathan.loding would be helpful

Thanks in advance
Praveen

In my opinion you should autowire your configuration (which loads properties from yaml), so configuration should also be a bean and not static somewhere. Also the connector function needs to be marked with @Component. Then everything should work automatically.

If your connector function is not a bean (component) then Camunda tries to create an instance with the no-args constructor. I’m not familiar with manually registering job handlers, but it seems you don’t need the @OutboundConnector annotation then (this is to automatically register the function) and you are now mixing both. You have to go for one approach.

Also make sure to use the latest connector runtime. In earlier versions it tried to create an instance with the no-args constructor even if there already was a bean.

Hi @cma
Thank you for your valuable reply
I have tried autowiring the configuration as you said

@Configuration
public class AppConfiguration {

	@Data
	@NoArgsConstructor
	public class Credentials {

		private Details details;	
	}

	@Bean(name = "credentials")
	public Credentials setCredentials()  {
		//creating the details required
		return new Credentials(details);

	}

In the outbound connector class

@Component
@OutboundConnector(
    name = "MYCONNECTOR",
    inputVariables = {"myProperty", "authentication"},
    type = "io.camunda:template:1"
)
public class MyConnectorFunction implements OutboundConnectorFunction {
       @Autowired
	private Credentials credentials;
       /also tried with setter, constructor injection

@Override
  public Object execute(OutboundConnectorContext context) throws Exception {
    
    var connectorRequest = context.getVariablesAsType(MyConnectorRequest.class);
   
     Logger.info(this.credentials)  // here it is null so unable to proceed further
    
    String message = executeConnector(connectorRequest,credentials.getDetails());//the static credential object from main class
  
}

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.xxx</groupId>
	<artifactId>xxx</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>xxx</name>
	<description>Demo project for Spring Boot</description>
	<properties>
		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>
	</properties>
	<dependencies>

			<!-- dependency for credentials -->


		<!-- https://mvnrepository.com/artifact/io.camunda.connector/spring-boot-starter-camunda-connectors -->
		<dependency>
			<groupId>io.camunda.connector</groupId>
			<artifactId>spring-boot-starter-camunda-connectors</artifactId>
			<version>0.21.3</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>2.0.7</version>
		</dependency>
			
		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.28</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>


</project>

as suggested I’m going with only one approach i.e. @OutboundConnnector (automatically register the function)

I’m using the spring boot starter camunda connectors dependency (latest)
Docker image - camunda/connectors:0.21.3

@cma Any thing I’m missing here

@Praveen_Kumar_Reddy No, I didn’t notice anything, looks good to me. Constructor injection would be preferred.

Just saw the comment that it is still null. What I would try is to use constructor injection and no no-args constructor, then you know for sure that the bean is taken and everything is autowired.

Is your connector runtime up to date? I’m using this artefact spring-zeebe-connector-runtime. The dependencies you listed are for the connector itself.

Hi @cma,
Thanks for your reply
Tried Running the application with no no-args constructor and using constructor injection in the Connector function class its again giving me the error of unable to get no-org constructor

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zeebeAnnotationProcessorRegistry' defined in class path resource [io/camunda/zeebe/spring/client/annotation/processor/AnnotationProcessorConfiguration.class]: Unsatisfied dependency expressed through method 'zeebeAnnotationProcessorRegistry' parameter 0: Error creating bean with name 'annotationProcessor' defined in class path resource [io/camunda/connector/runtime/outbound/OutboundConnectorRuntimeConfiguration.class]: Unsatisfied dependency expressed through method 'annotationProcessor' parameter 0: Error creating bean with name 'outboundConnectorManager' defined in class path resource [io/camunda/connector/runtime/outbound/OutboundConnectorRuntimeConfiguration.class]: Unsatisfied dependency expressed through method 'outboundConnectorManager' parameter 1: Error creating bean with name 'outboundConnectorFactory' defined in class path resource [io/camunda/connector/runtime/outbound/OutboundConnectorRuntimeConfiguration.class]: Failed to instantiate [io.camunda.connector.runtime.core.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception with message: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConectorFunction Unable to get public no-arg constructor

Yes, The dependencies are for connector only, I’m using the latest version released artifact supported for connector runtime through springboot

Ok then this is not fixed yet in this library. I would recommend just to use the artifact I linked for the connector runtime.

Thanks for your Reply @cma
I have changed the dependency to suggested one
I’m getting the below error of unsatisfied dependency

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zeebeAnnotationProcessorRegistry' defined in class path resource [io/camunda/zeebe/spring/client/annotation/processor/AnnotationProcessorConfiguration.class]: Unsatisfied dependency expressed through method 'zeebeAnnotationProcessorRegistry' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'outboundConnectorAnnotationProcessor' defined in class path resource [io/camunda/zeebe/spring/client/annotation/processor/AnnotationProcessorConfiguration.class]: Unsatisfied dependency expressed through method 'outboundConnectorAnnotationProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'outboundConnectorManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Unsatisfied dependency expressed through method 'outboundConnectorManager' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobWorkerManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ZeebeClientAllAutoConfiguration.class]: Unsatisfied dependency expressed through method 'jobWorkerManager' parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outboundConnectorFactory' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.util.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception; nested exception is java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConnectorFunction Unable to get public no-arg constructor
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:258)
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
	at com.xxx.connector.ConnectorBootApplication.main(GoogleCloudStorageBootApplication.java:15)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'outboundConnectorAnnotationProcessor' defined in class path resource [io/camunda/zeebe/spring/client/annotation/processor/AnnotationProcessorConfiguration.class]: Unsatisfied dependency expressed through method 'outboundConnectorAnnotationProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'outboundConnectorManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Unsatisfied dependency expressed through method 'outboundConnectorManager' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobWorkerManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ZeebeClientAllAutoConfiguration.class]: Unsatisfied dependency expressed through method 'jobWorkerManager' parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outboundConnectorFactory' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.util.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception; nested exception is java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConnectorFunction Unable to get public no-arg constructor
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1609)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1573)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1462)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1349)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 18 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'outboundConnectorManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Unsatisfied dependency expressed through method 'outboundConnectorManager' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobWorkerManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ZeebeClientAllAutoConfiguration.class]: Unsatisfied dependency expressed through method 'jobWorkerManager' parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outboundConnectorFactory' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.util.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception; nested exception is java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConnectorFunction Unable to get public no-arg constructor
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 35 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobWorkerManager' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ZeebeClientAllAutoConfiguration.class]: Unsatisfied dependency expressed through method 'jobWorkerManager' parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outboundConnectorFactory' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.util.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception; nested exception is java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConnectorFunction Unable to get public no-arg constructor
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 49 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outboundConnectorFactory' defined in class path resource [io/camunda/zeebe/spring/client/configuration/ConnectorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.util.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception; nested exception is java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConnectorFunction Unable to get public no-arg constructor
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
	... 63 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.camunda.connector.runtime.util.outbound.OutboundConnectorFactory]: Factory method 'outboundConnectorFactory' threw exception; nested exception is java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.xxx.connector.ConnectorFunction Unable to get public no-arg constructor
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 77 common frames omitted
Caused by: java.util.ServiceConfigurationError: io.camunda.connector.api.outbound.OutboundConnectorFunction: com.acheron.connector.GoogleCloudStorageFunction Unable to get public no-arg constructor
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
	at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:679)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1240)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$ProviderSpliterator.tryAdvance(ServiceLoader.java:1491)
	at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at io.camunda.connector.runtime.util.discovery.SPIConnectorDiscovery.discoverOutbound(SPIConnectorDiscovery.java:38)
	at io.camunda.connector.runtime.util.outbound.DefaultOutboundConnectorFactory.loadConnectorConfigurations(DefaultOutboundConnectorFactory.java:91)
	at io.camunda.connector.runtime.util.outbound.DefaultOutboundConnectorFactory.<init>(DefaultOutboundConnectorFactory.java:42)
	at io.camunda.zeebe.spring.client.configuration.ConnectorConfiguration.outboundConnectorFactory(ConnectorConfiguration.java:27)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 78 common frames omitted
Caused by: java.lang.NoSuchMethodException: com.xxx.connector.ConnectorFunction.<init>()
	at java.base/java.lang.Class.getConstructor0(Class.java:3585)
	at java.base/java.lang.Class.getConstructor(Class.java:2271)
	at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:666)
	at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:663)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:674)
	... 97 common frames omitted

Seems to be the same problem, but GoogleCloudStorageFunction is causing it, not MyConnectorFunction. Is this also your connector? But with this library it should work if you add a no-args constructor (bean takes precedence), but then you have to add the autowired one and the no-args constructor manually and can’t use lombok.

I personally still use 8.1.17 with a manually fixed io.camunda.zeebe.spring.client.connector.OutboundConnectorManager, but looking at the commits I thought this was fixed with 8.1.18, but I might be wrong, just never had time to update and test it.

Hey @cma I have solved the issue
I was not doing the build properly with all dependencies
No i have changed my pom.xml as below

<build>
		<plugins>
			<plugin>
				<version>3.6.0</version>
				<artifactId>maven-assembly-plugin</artifactId>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
			</plugin>
		</plugins>
	</build>

While using with SpringBoot with this dependency in local as the jar with all dependencies will be running application starts and works fine but the dockerfile was not added with the extra dependencies, so in docker it was failing

In the case of connector core dependency It was not the same as we cannot run it in local as a spring boot or java application,

When I used jar with dependencies even though the credential object is in static block it is able to take it in the @OutboundConnector and performing operations

Thank you for your time and effort @cma

I don’t think I have the permission to close this issue

If anybody has the permission please close this

Thanks and regards
Praveen

@Praveen_Kumar_Reddy You are welcome. The thread will be closed in 7 days if you select something as an answer. The only way normal users like us can close the thread indirectly.

1 Like

@cma How to select a reply as solution

@Praveen_Kumar_Reddy There should be like a grayed-out checkbox at the bottom of every post, to the left of reply, edit, etc.


No option available for me like that

:thinking: strange. I don’t know, I always had this option when I was the one asking the question.

@cma That’s what I’m wondering :smile:
If any person with permission can mark as solution please mark it

Strange configuration issue with the “Solved” feature, but should be fixed now! :crossed_fingers:t2:

1 Like

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