Uploaded image for project: 'Apache Fineract'
  1. Apache Fineract
  2. FINERACT-1459

Data Migration issue (Subquery returns more than 1 row) in V370__message_gateway_hook_template.sql

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.6.0
    • None
    • None
    • None

    Description

      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:

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            vorburger Michael Vorburger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: