title: DdlTransactionIsolatorJtaImpl could not locate TransactionManager
body: <p>So, I've been trying for many days to run my project, without success.
  Spring Boot + Hibernate + JPA. Oracle database.
  Can anybody help me?</p>
  
  <p>config.properties:</p>
  
  
  
  <pre><code>hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
  hibernate.hbm2ddl.auto=validate
  </code></pre>
  
  <p>application.properties:</p>
  
  <pre class="lang-plain prettyprint-override"><code>spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl
  spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
  spring.datasource.username=data_integration
  spring.datasource.password=secret
  </code></pre>
  
  <p>My pom.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.0.0.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;version&gt;2.0.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
              &lt;version&gt;2.0.0.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;5.0.4.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;5.2.16.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;5.2.16.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;com.zaxxer&lt;/groupId&gt;
              &lt;artifactId&gt;HikariCP&lt;/artifactId&gt;
              &lt;version&gt;2.7.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
              &lt;version&gt;8.5.29&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;ua.com.oracle&lt;/groupId&gt;
              &lt;artifactId&gt;ojdbc7&lt;/artifactId&gt;
              &lt;version&gt;12.1.0.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
              &lt;artifactId&gt;javax.transaction-api&lt;/artifactId&gt;
              &lt;version&gt;1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.7.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>MyApplicationConfig.java</p>
  
  <pre class="lang-java prettyprint-override"><code>package com.eximb.crmon;
  
  import java.util.Properties;
  
  import javax.persistence.EntityManagerFactory;
  import javax.sql.DataSource;
  
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.PropertySource;
  import org.springframework.orm.jpa.JpaTransactionManager;
  import org.springframework.orm.jpa.JpaVendorAdapter;
  import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
  import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
  import org.springframework.transaction.PlatformTransactionManager;
  import org.springframework.transaction.annotation.EnableTransactionManagement;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  
  @Configuration
  @PropertySource("classpath:config.properties")
  @EnableTransactionManagement
  @EnableWebMvc
  
  public class ApplicationConfig implements WebMvcConfigurer {
  
  @Value("${hibernate.dialect}")
  private String sqlDialect;
  
  @Value("${hibernate.hbm2ddl.auto}")
  private String hbm2ddlAuto;
  
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {
  
      LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
      entityManagerFactory.setJtaDataSource(dataSource);
      entityManagerFactory.setJpaVendorAdapter(jpaVendorAdapter);
      entityManagerFactory.setJpaProperties(addProperties());
      entityManagerFactory.setPackagesToScan("com.eximb.crmon");
  
      return entityManagerFactory;
  
  }
  
  @Bean
  public JpaVendorAdapter jpaVendorAdapter() {
  
      HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
      adapter.setShowSql(true);
      adapter.setDatabasePlatform(sqlDialect);
  
      return adapter;
  
  }
  
  @Bean
  public PlatformTransactionManager transactionManager(EntityManagerFactory emf){
  
      return new JpaTransactionManager(emf);
  
  }
  
  
  private Properties addProperties() {
  
      Properties properties = new Properties();
      properties.setProperty("hibernate.hbm2ddl.auto", hbm2ddlAuto);
  
      return properties;
  
  }
  
  @Override
  public void configureViewResolvers(ViewResolverRegistry viewRegistry) {
  
      viewRegistry.jsp("/WEB-INF/pages/", ".jsp");
  
  }
  
  @Override
  public void addResourceHandlers(ResourceHandlerRegistry resourceRegistry) {
  
      resourceRegistry.addResourceHandler("/static_content/**").addResourceLocations("/WEB-INF/static_content/");
  
  }
  }
  </code></pre>
  
  <p>StackTrace:</p>
  
  <pre class="lang-plain prettyprint-override"><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/eximb/crmon/ApplicationConfig.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1710)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
          at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
          at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1085)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:858)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
          at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
          at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
          at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
          at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
          at com.eximb.crmon.Application.main(Application.java:9)
          ... 6 more
  Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
          at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:970)
          at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:895)
          at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57)
          at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
          at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:388)
          at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377)
          at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1769)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706)
          ... 22 more
  Caused by: org.hibernate.HibernateException: DdlTransactionIsolatorJtaImpl could not locate TransactionManager to suspend any current transaction; base JtaPlatform impl (org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform@589acbb1)?
          at org.hibernate.resource.transaction.backend.jta.internal.DdlTransactionIsolatorJtaImpl.&lt;init&gt;(DdlTransactionIsolatorJtaImpl.java:46)
          at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl.buildDdlTransactionIsolator(JtaTransactionCoordinatorBuilderImpl.java:46)
          at org.hibernate.tool.schema.internal.HibernateSchemaManagementTool.getDdlTransactionIsolator(HibernateSchemaManagementTool.java:175)
          at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:59)
          at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:191)
          at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
          at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:312)
          at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:460)
          at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
          ... 29 more
  </code></pre>