Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-1005

Error bootstrapping Spring Data JPA with EntityManagerFactory already semi-initialized

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.10.5 (Hopper SR5)
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Java 1.8, Spring 4.3.4, Spring Platform Bom Athens-SR1

      Description

      Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.Set<javax.persistence.EntityManager>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

      We traced this back to the change in:
      https://github.com/spring-projects/spring-data-jpa/commit/585ada91f309b84da00a0925317489e14732ea5d#diff-d3bc754b3e335bfa1ddeb79d4898f434R130

      Could it be that the "else if" line on line 130 should be inside the first if, like so:

      		if (JNDI_OBJECT_FACTORY_BEAN.equals(definition.getBeanClassName())) {
      			if (!EntityManagerFactory.class.getName().equals(definition.getPropertyValues().get("expectedType"))) {
      				return;
      			} else if (!EntityManagerFactory.class.equals(beanFactory.getType(name))) {
      				return;
      			}
      		}
      

      I should also mention we do not use JNDI (object factories) and that under 1.10.2 this method does return a valid definition (the only change was lines 130 and 131 between 1.10.2 and 1.10.5).

      Seems a regression from DATAJPA-956 ?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              slyoldfox Marc Vanbrabant
              Last updater:
              Spring Issues Spring Issues
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: