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

Michael Vorburger commented on FINERACT-1459:
---------------------------------------------

I've attempted to debug this issue:

_Subquery returns more than 1 row_ seems to mean that {{select id from 
m_hook_templates  where name = 'Message Gateway'}} returns more than 1 row - 
except it does not, on that database.

That (entire) statement actually does work when executed manually. But my DB in 
question actually already had that row, so I'm not sure why Flyway thinks it 
needs to re-run this.

But https://github.com/apache/fineract/search?q=m_hook_templates shows no 
obvious duplicates or anything like that.

I'm giving up on this, and pursuing the https://www.fineract.dev by simply 
entirely resetting the database.

This may or may not be a fluke issue on the demo server, only. I'll keep this 
issue open as a Minor - just in case others hit this as well, and can 
investigate further. (I won't be further debugging this myself.)

> Data Migration issue (Subquery returns more than 1 row) in 
> V370__message_gateway_hook_template.sql
> --------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-1459
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1459
>             Project: Apache Fineract
>          Issue Type: Bug
>    Affects Versions: 1.6.0
>            Reporter: Michael Vorburger
>            Priority: Minor
>
> https://www.fineract.dev was failing to upgrade to the latest bleeding edge 
> Fineract code from master branch, see 
> https://github.com/vorburger/www.fineract.dev/issues/8, due to the following:
> {noformat}Caused by: 
> org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
> creating bean with name 'userDetailsService': Unsatisfied dependency 
> expressed through field 'platformUserRepository'; nested exception is 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'appUserRepository' defined in 
> org.apache.fineract.useradministration.domain.AppUserRepository defined in 
> @EnableJpaRepositories declared on PersistenceConfig: Cannot create inner 
> bean '(inner bean)#3636f2a7' of type 
> [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean 
> property 'entityManager'; nested exception is 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name '(inner bean)#3636f2a7': Cannot resolve reference to bean 
> 'entityManagerFactory' while setting constructor argument; nested exception 
> is org.springframework.beans.factory.BeanCreationException: Error creating 
> bean with name 'tenantDatabaseUpgradeService': Invocation of init method 
> failed; nested exception is org.flywaydb.core.api.FlywayException: Migration 
> V370__message_gateway_hook_template.sql failed
> --------------------------------------------------------
> SQL State  : 21000
> Error Code : 1242
> Message    : (conn=492) Subquery returns more than 1 row
> Location   : sql/migrations/core_db/V370__message_gateway_hook_template.sql 
> (/app/sql/migrations/core_db/V370__message_gateway_hook_template.sql)
> Line       : 25
> Statement  : INSERT INTO m_hook_schema
> (hook_template_id, field_type, field_name, placeholder, optional)
> VALUES( (select id from m_hook_templates  where name = 'Message Gateway'), 
> 'string', 'SMS Provider Id', NULL, 0)
> ; for Tenant DB URL: jdbc:mariadb://10.103.176.16:3306/fineract_default, 
> username: root
>         at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
>         at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
>         at 
> org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
>         at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
>         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:1380)
>         at 
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
>         at 
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
>         ... 62 common frames omitted
> Caused by: org.springframework.beans.factory.BeanCreationException: Error 
> creating bean with name 'appUserRepository' defined in 
> org.apache.fineract.useradministration.domain.AppUserRepository defined in 
> @EnableJpaRepositories declared on PersistenceConfig: Cannot create inner 
> bean '(inner bean)#3636f2a7' of type 
> [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean 
> property 'entityManager'; nested exception is 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name '(inner bean)#3636f2a7': Cannot resolve reference to bean 
> 'entityManagerFactory' while setting constructor argument; nested exception 
> is org.springframework.beans.factory.BeanCreationException: Error creating 
> bean with name 'tenantDatabaseUpgradeService': Invocation of init method 
> failed; nested exception is org.flywaydb.core.api.FlywayException: Migration 
> V370__message_gateway_hook_template.sql failed{noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to