Details
-
Bug
-
Status: Closed
-
Resolution: No Longer Reproducible
-
7.2.0 GA1
-
None
Description
A Service Builder module's entity tables should be created in the data source configured for that module.
Steps:
- Create a maria DB database called external
create database external character set utf8;
- Add a portal-ext.properties file that specifies your external database and db host (e.g., hostname/external) and restart the server.
jdbc.ext.driverClassName=org.mariadb.jdbc.Driver jdbc.ext.url=jdbc:mariadb://hostname/external?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.ext.username=root jdbc.ext.password=my-secret-pw
- Unzip the attached Liferay Workspace. It contains the guestbook application Service Builder modules (api, service, web). The service module provides a DataSourceProvider class called
com.liferay.docs.guestbook.internal.DataSourceProviderImpl
This file configures the module's services to use that datasource:
com-liferay-docs-guestbook/modules/guestbook/guestbook-service/src/main/resources/META-INF/services/com.liferay.portal.kernel.dao.jdbc.DataSourceProvider
- Build the services:
gw buildService
- Build the module JARs:
gw deploy
The JARs are created in the workspace's
bundles/osgi/modules
folder.
- Copy the JARs to your Liferay Home/deploy folder.
Expected Result:
The entity tables GB_Guestbook and GB_GuestbookEntry are created in the external database.
Actual Results:
The entity tables are created in the default database.
5. Add the widget (Widget > Social > Guestbook) to a page.
Expected Result:
- The Guestbook portlet renders
Actual Results:
- Portlet message in UI: "Portlet is temporarily unavailable"
- Console message:
ERROR [http-nio-8080-exec-6][JDBCExceptionReporter:234] Table 'external.guestbook' doesn't exist ... Caused by: org.mariadb.jdbc.internal.common.QueryException: Table 'external.guestbook' doesn't exist
A Simpler Sample: is at https://github.com/jhinkey/liferay-blade-samples/tree/service-builder-dsp/gradle/apps/service-builder/dsp
It has a table called country in namespace DSPCOUNTRY.