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.


Leave a Reply

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

%d bloggers like this: