Type: Regression Bug
Affects Version/s: 7.0.X, Master
Component/s: Core Infrastructure > Database Access
If you want to enable separate read/write data sources, you have to uncomment dynamic-data-source-spring.xml line in portal-ext.properties.
More information, see: https://dev.liferay.com/discover/deployment/-/knowledge_base/7-0/liferay-clustering#read-writer-database-configuration
But from Liferay 7 version, a "cannot resolve reference to bean 'transactionAttributeSource' " error is thrown after enabling that spring xml file.
The root cause of this issue is
LPS-54649. All spring configuration files where divided in two groups: spring.infrastructure.configs and spring.configs
dynamic-data-source-spring.xml is included in spring.infrastructure.configs group, but it has a lot of dependencies with beans in spring.configs
Steps to reproduce
- Configure a new Liferay installation using a database, for example mysql:
- Start Liferay and verify database tables were created
- Stop Liferay in order to configure read/write setup
- Copy spring and spring.infrastructure section from portal.properties file to your portal-ext.properties:
- Uncomment dynamic-data-source-spring.xml lines. Important: After the changes of this LPS you will see two lines:
- Add jdbc.read. and jdbc.write. properties, pointing to same database than jdbc.default.. They should be different databases with replication, but for this issue it is not necessary to setup all that infrastructure.
- Comment jdbc.default properties added in step 1
- Add following lines:
- With read/write setup, "default" dataSource won't be used by Liferay, but jdbc driver will try connecting due to 'jdbc.default.validationQuery' configuration (it was added in
LPS-64624). Add following lines to avoid jdbc driver connecting to "default" data source:
- Start Liferay
- : Liferay starts successfully
- : Following error is thrown in log file
Note: You have more information about configuring this in https://dev.liferay.com/discover/deployment/-/knowledge_base/7-0/liferay-clustering#read-writer-database-configuration