Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type ‘javax.sql.DataSource’ that could not be found. – Bean method ‘dataSource’ not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property ‘jndi-name’ – Bean method ‘dataSource’ not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans

This error message is indicating that your application is unable to find a bean of type ‘javax.sql.DataSource’ that is required by HibernateJpaAutoConfiguration. The error message suggests that there is a missing @ConditionalOnProperty annotation on the dataSource() method, which is causing the bean not to be loaded.

The @ConditionalOnProperty annotation checks for the presence of a specified property in the application’s configuration. In this case, it is looking for the ‘spring.datasource.jndi-name’ property. If this property is not present in the application’s configuration, the dataSource() method will not be executed, and the bean will not be created.

To fix the problem, you need to ensure that the ‘spring.datasource.jndi-name’ property is present in your application’s configuration and it’s pointing to a valid JNDI name.

Additionally, the message mentiones the @ConditionalOnBean which the application is unable to find any beans of types org.springframework.boot.jta.XADataSourceWrapper to be loaded. You could check your project configuration if you are using any XA DataSource and if so check its configurations.


org.springframework.boot.jta.XADataSourceWrapper is a class in the Spring Boot JTA module that provides an XA-compliant wrapper for a regular JDBC DataSource. This class is typically used in situations where your application needs to participate in a JTA (Java Transaction API) transaction that spans multiple databases or other transactional resources.

An XA DataSource is a DataSource that is compliant with the XA specification and can be used in a JTA transaction. This class helps to manage and wrap these XA-compliant DataSources.

It could be you are trying to use XA-transactions but you missed the required configurations to use it like setting the transaction manager, or you might not need it if your application doesn’t require distributed transactions. So you should check your application’s transaction requirements and configurations.

Also, org.springframework.boot.jta.XADataSourceWrapper is part of spring-boot-starter-jta dependency, make sure you have this dependency included in your project.

More Solutions:

  1. Missing database configuration: Ensure that you have the necessary database configuration in your or application.yml file. For example:

    Make sure to replace the placeholders with your actual database connection details.
  2. Missing database driver dependency: Ensure that you have the appropriate database driver dependency in your build configuration file (e.g., pom.xml for Maven or build.gradle for Gradle). For example, if you’re using MySQL:
    For Maven:

    For Gradle:
  3. If you’re using JNDI or a custom DataSource bean: Make sure that you have properly configured the JNDI properties or your custom DataSource bean in the application context.
    For JNDI, in your or application.yml:

    For a custom DataSource bean, define it in one of your configuration classes:
  4. If you’re using JTA (Java Transaction API) with an XADataSource: Ensure that you have the necessary dependencies and configuration in your project. The error message suggests that the Spring Boot application context could not find any beans of type XADataSourceWrapper.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: