Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-92574

External Datasource doesn't work when using parent folder for ext-spring in Liferay 7.2




      External Datasource, declared using a parent context extension (e.g. ext-spring.xml), does not work when placed in folder: src/main/resources/META-INF/spring/parent for Liferay 7.2

      In Liferay 7.1, LPS-88444 made it possible to place your parent context extension (e.g. ext-spring.xml) configurations in both:

      • src/main/resources/META-INF/spring
      • src/main/resources/META-INF/spring/parent

      Steps to Reproduce

      This can be broken up into multiple parts:

      1. Setup External Datasource
      2. Setup Liferay Blade Sample
      3. Reproduce in Liferay

      Setup External Datasource
      The external datasource will be based on Liferay's example: Connecting Service Builder to External Databases

      This datasource will be used by the Liferay Blade Sample that will be discussed below.

      To setup our external datasource, we will need to:

      1. Create a database called: External
      2. Create a table called: country
      3. Insert an entry into table country

      Example: SQL Script to generate the datasource in MYSQL

      CREATE DATABASE external CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
      CREATE TABLE external.`country` (
        `id` bigint(20) NOT NULL,
        `name` varchar(255) DEFAULT NULL,
        PRIMARY KEY (`id`)
      INSERT INTO external.country
      VALUES (1, 'TEST');

      Setup Liferay Blade Sample
      The Liferay Blade Sample for Service Builder JNDI can be used to reproduce this issue: Service Builder - JNDI

      We will make one modification, which is to move the file: ext-spring.xml

      1. Move src/main/resources/META-INF/spring/ext-spring.xml to src/main/resources/META-INF/spring/parent/ext-spring.xml

      Attached is a sample poc module, created based on the instructions above:

      Reproduce in Liferay

      • Specify the External Datasource in portal-ext.properties (modify as needed):
      • Startup Liferay 7.2
      • Deploy customized Liferay Blade Sample module

      Expected Results:
      No errors are thrown in the logs during module deployment

      Actual Results:
      Errors are thrown in the logs regarding 'extDataSource'

      QA: Verify Fix
      There is a test module that is available: external-data-source-test-controller-test
      Please make sure the tests pass for this module as well.

      Note: You must use hypersonic for this test

      Steps to run the test:

      1. Setup Liferay environment with fix (fully compiled and deployed)
      2. Make sure Deployed bundle is using Hypersonic as it's database
      3. Navigate to modules/test/external-data-source-test-controller-test
      4. Run gw testIntegration


          Issue Links



              • Assignee: