Hi Awasum,

Attached the error that we are getting each time when we try to deploy a service with more than one feign-client dependencies.

The attached error is for

org.apache.fineract.cn.teller.TellerConfiguration
@EnableFeignClients(
    clients = {
        OrganizationManager.class,
        LedgerManager.class,
        DepositAccountManager.class,
        PortfolioManager.class,
        ChequeManager.class }
)

reaching more than one feign REST service like 
org.apache.fineract.cn.cheque.api.v1.client.ChequeManager  from 
org.apache.fineract.cn.teller.service.internal.service.helper.ChequeService  
and the others from another services.

The same issue we have with each similar service like fineract-cn-portfolio, 
fineract-cn-cheque, fineract-cn-deposit-account-management...

I've created a new microservice with several feign-client connections and have 
the same issue with that. The other modules we did not touch, only we do not 
run all the services. For deploy we run the
deploy-server-0.1.0-BUILD-SNAPSHOT.jar. Do you have any idea how to solve this 
issue?

Thank you,
Márti


On 2019. 01. 14. 12:43, Awasum Yannick wrote:
Hello Peter,

Please paste your logs here containing the error message and share the piece of code you have modified or trying to modify. Also tell us what you have done to try to fix the issue.
This will help anyone who wish to help you.

Thanks.
Awasum

On Mon, Jan 14, 2019 at 11:15 AM Peter Santa <peter.sa...@dpc.hu <mailto:peter.sa...@dpc.hu>> wrote:

    Hello Everyone!

    We are working on integrating Fineract CN with Mojaloop.

    Has someone faced the problem with feign client, that when more
    than 1 client is referred by a microservice, then an exception is
    thrown during provisioning (when running ServiceRunner), by hystrix?
    Is there any best practice to solve this?

    Thank you.

    Péter Sánta
    DPC Consulting Ltd.

11:22:40.053 [main] ERROR o.s.boot.SpringApplication - Application startup 
failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'tellerOperationRestController' defined in URL 
[jar:file:/home/jmarta/dpc/mojaloop/fineract-cn/deployment/jars/fineract-cn-teller/service-0.1.0-BUILD-SNAPSHOT-boot.jar!/BOOT-INF/classes!/org/apache/fineract/cn/teller/service/rest/TellerOperationRestController.class]:
 Unsatisfied dependency expressed through constructor parameter 5; nested 
exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'chequeService' defined in URL 
[jar:file:/home/jmarta/dpc/mojaloop/fineract-cn/deployment/jars/fineract-cn-teller/service-0.1.0-BUILD-SNAPSHOT-boot.jar!/BOOT-INF/classes!/org/apache/fineract/cn/teller/service/internal/service/helper/ChequeService.class]:
 Unsatisfied dependency expressed through constructor parameter 1; nested 
exception is org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'org.apache.fineract.cn.cheque.api.v1.client.ChequeManager': FactoryBean threw 
exception on object creation; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'customFeignClientsConfiguration': Invocation of init method failed; 
nested exception is java.lang.IllegalStateException: Another strategy was 
already registered.
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
        at 
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1148)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1051)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751)
        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
        at 
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
        at 
org.apache.fineract.cn.teller.TellerApplication.main(TellerApplication.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'chequeService' defined in URL 
[jar:file:/home/jmarta/dpc/mojaloop/fineract-cn/deployment/jars/fineract-cn-teller/service-0.1.0-BUILD-SNAPSHOT-boot.jar!/BOOT-INF/classes!/org/apache/fineract/cn/teller/service/internal/service/helper/ChequeService.class]:
 Unsatisfied dependency expressed through constructor parameter 1; nested 
exception is org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'org.apache.fineract.cn.cheque.api.v1.client.ChequeManager': FactoryBean threw 
exception on object creation; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'customFeignClientsConfiguration': Invocation of init method failed; 
nested exception is java.lang.IllegalStateException: Another strategy was 
already registered.
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
        at 
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1148)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1051)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1128)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1056)
        at 
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        ... 27 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'org.apache.fineract.cn.cheque.api.v1.client.ChequeManager': FactoryBean threw 
exception on object creation; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'customFeignClientsConfiguration': Invocation of init method failed; 
nested exception is java.lang.IllegalStateException: Another strategy was 
already registered.
        at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
        at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1600)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1286)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1255)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1091)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1056)
        at 
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        ... 41 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'customFeignClientsConfiguration': Invocation of init 
method failed; nested exception is java.lang.IllegalStateException: Another 
strategy was already registered.
        at 
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1575)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751)
        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
        at 
org.springframework.cloud.context.named.NamedContextFactory.createContext(NamedContextFactory.java:110)
        at 
org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:79)
        at 
org.springframework.cloud.context.named.NamedContextFactory.getInstance(NamedContextFactory.java:115)
        at 
org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getOptional(FeignClientFactoryBean.java:141)
        at 
org.springframework.cloud.netflix.feign.FeignClientFactoryBean.feign(FeignClientFactoryBean.java:86)
        at 
org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:160)
        at 
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
        ... 52 common frames omitted
Caused by: java.lang.IllegalStateException: Another strategy was already 
registered.
        at 
com.netflix.hystrix.strategy.HystrixPlugins.registerConcurrencyStrategy(HystrixPlugins.java:190)
        at 
org.apache.fineract.cn.api.util.CustomFeignClientsConfiguration.configureHystrixConcurrencyStrategy(CustomFeignClientsConfiguration.java:105)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365)
        at 
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:310)
        at 
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
        ... 70 common frames omitted

Reply via email to