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

Liferay-Blade-Samples project not work: Service Builder generated API cannot switch to External Datasource

    Details

      Description

      Service Builder Application Using External Database via JDBC

      Steps to reproduce this issue:
      1. Build JDBC sample: :apps:service-builder:jdbc
      https://github.com/liferay/liferay-blade-samples/tree/7.1/liferay-workspace/apps/service-builder/jdbc
      2. Follow the instruction and create external DB schema with country table and portal-ext.properties
      https://dev.liferay.com/en/develop/reference/-/knowledge_base/7-1/service-builder-application-using-external-database-via-jdbc
      3. Deploy builder services and portlet:
      com.liferay.blade.samples.jdbcservicebuilder.api-1.0.0.jar
      com.liferay.blade.samples.jdbcservicebuilder.service-1.0.0.jar
      com.liferay.blade.samples.jdbcservicebuilder.web-1.0.0.jar

      The error log from Tomcat say that DataSource is not switched to the external. DB schema is 'lportal' instead of 'external'

      Caused by: java.sql.SQLSyntaxErrorException: Table 'lportal.country' doesn't exist
      	at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:138)
      	at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
      	at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:268)
      	at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:296)
      	at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:349)
      	at org.mariadb.jdbc.MySQLPreparedStatement.executeQuery(MySQLPreparedStatement.java:104)
      	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:73)
      	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:73)
      	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
      	at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
      	at org.hibernate.loader.Loader.doQuery(Loader.java:802)
      	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
      	at org.hibernate.loader.Loader.doList(Loader.java:2542)
      	... 236 more
      
      Caused by: org.mariadb.jdbc.internal.common.QueryException: Table 'lportal.country' doesn't exist
      	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:995)
      	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1050)
      	at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:1030)
      	at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:289)
      

      And WEB PORTLET say: No data

       

      p.s. The same results with JNDI sample too:
      Caused by: java.sql.SQLSyntaxErrorException: Table 'lportal.region' doesn't exist

        Attachments

          Activity

            People

            • Assignee:
              summer.zhang Summer Zhang
              Reporter:
              sytolk Stanimir
              Participants of an Issue:
              Recent user:
              Summer Zhang
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                14 weeks, 4 days ago

                Packages

                Version Package
                7.1.X