[ 
https://issues.apache.org/jira/browse/CAMEL-23217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18067938#comment-18067938
 ] 

Marco Carletti commented on CAMEL-23217:
----------------------------------------

grpc-protobuf:1.80.0 declares protobuf-java:3.25.8 as a direct dependency; 
camel-parent overrides it to 4.x via dependencyManagement, but 
camel-spring-boot-bom does not propagate that managed version, so the archetype 
project resolves 3.25.8 which lacks RuntimeVersion$RuntimeDomain required by 
the Salesforce Pub/Sub API classes


{code:bash}
#generate archetype
mvn -q archetype:generate -B -DarchetypeGroupId=org.apache.camel.archetypes 
-DarchetypeArtifactId=camel-archetype-spring-boot 
-DarchetypeVersion=4.19.0-SNAPSHOT -DgroupId=com.example 
-DartifactId=camel-salesforce -Dversion=1.0-SNAPSHOT -Dpackage=com.example 

#edit pom adding the starter
cd camel-salesforce/

#edit pom.xml adding 
#
#<dependency>
# <groupId>org.apache.camel.springboot</groupId>
#  <artifactId>camel-salesforce-starter</artifactId>
#</dependency>


mvn dependency:tree -Dincludes=com.google.protobuf:protobuf-java

...
[INFO] com.example:camel-salesforce:jar:1.0-SNAPSHOT
[INFO] \- 
org.apache.camel.springboot:camel-salesforce-starter:jar:4.19.0-SNAPSHOT:compile
[INFO]    \- org.apache.camel:camel-salesforce:jar:4.19.0-SNAPSHOT:compile
[INFO]       \- io.grpc:grpc-protobuf:jar:1.80.0:compile
[INFO]          \- com.google.protobuf:protobuf-java:jar:3.25.8:compile
....


#compared to the dependency managed by the starter itself

mvn dependency:tree -Dincludes=com.google.protobuf:protobuf-java -f 
components-starter/camel-salesforce-starter/pom.xml

...
[INFO] org.apache.camel.springboot:camel-salesforce-starter:jar:4.19.0-SNAPSHOT
[INFO] \- org.apache.camel:camel-salesforce:jar:4.19.0-SNAPSHOT:compile
[INFO]    \- io.grpc:grpc-protobuf:jar:1.80.0:compile
[INFO]       \- com.google.protobuf:protobuf-java:jar:4.33.2:compile
...
{code}


> CamelSalesforceIT is failing on SpringBoot with NoClassDefFoundError: 
> com/google/protobuf/RuntimeVersion$RuntimeDomain
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-23217
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23217
>             Project: Camel
>          Issue Type: Test
>          Components: camel-salesforce, camel-spring-boot-starters
>    Affects Versions: 4.19.0
>            Reporter: Aurélien Pupier
>            Priority: Major
>
> {noformat}
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
> creating bean with name 
> 'org.apache.camel.component.salesforce.springboot.SalesforceComponentAutoConfiguration':
>  Unsatisfied dependency expressed through field 'configuration': Error 
> creating bean with name 
> 'camel.component.salesforce-org.apache.camel.component.salesforce.springboot.SalesforceComponentConfiguration':
>  Failed to instantiate 
> [org.apache.camel.component.salesforce.springboot.SalesforceComponentConfiguration]:
>  Constructor threw exception
>       at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:767)
>       at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:748)
>       at 
> org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:146)
>       at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:493)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1446)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
>       at 
> org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:333)
>       at 
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:371)
>       at 
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
>       at 
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
>       at 
> org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1218)
>       at 
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1184)
>       at 
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1121)
>       at 
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:994)
>       at 
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:621)
>       at 
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:756)
>       at 
> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:445)
>       at 
> org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>       at 
> org.apache.camel.itest.springboot.common.AbstractSpringBootBaseTestSupport.compileAndStartApp(AbstractSpringBootBaseTestSupport.java:140)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error 
> creating bean with name 
> 'camel.component.salesforce-org.apache.camel.component.salesforce.springboot.SalesforceComponentConfiguration':
>  Failed to instantiate 
> [org.apache.camel.component.salesforce.springboot.SalesforceComponentConfiguration]:
>  Constructor threw exception
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1344)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1231)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:565)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:525)
>       at 
> org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:333)
>       at 
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:371)
>       at 
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
>       at 
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:201)
>       at 
> org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:229)
>       at 
> org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1762)
>       at 
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1651)
>       at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:764)
>       ... 22 more
> Caused by: org.springframework.beans.BeanInstantiationException: Failed to 
> instantiate 
> [org.apache.camel.component.salesforce.springboot.SalesforceComponentConfiguration]:
>  Constructor threw exception
>       at 
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:220)
>       at 
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:106)
>       at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1338)
>       ... 33 more
> Caused by: java.lang.NoClassDefFoundError: 
> com/google/protobuf/RuntimeVersion$RuntimeDomain
>       at 
> com.salesforce.eventbus.protobuf.ReplayPreset.<clinit>(ReplayPreset.java:48)
>       at 
> org.apache.camel.component.salesforce.springboot.SalesforceComponentConfiguration.<init>(SalesforceComponentConfiguration.java:371)
>       at 
> java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
>       at 
> java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
>       at 
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:194)
>       ... 35 more
> Caused by: java.lang.ClassNotFoundException: 
> com.google.protobuf.RuntimeVersion$RuntimeDomain
>       at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
>       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
>       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
>       ... 40 more {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to