Details

    • Branch Version/s:
      6.1.x, 6.0.x
    • Backported to Branch:
      Committed
    • Story Points:
      4
    • Similar Issues:
      Show 5 results 

      Description

      I crated a topic here: http://www.liferay.com/community/forums/-/message_boards/message/6462092

      We are using Liferay with connection configured to use JNDI:

      jdbc.default.jndi.name=jdbc/LiferayPool

      And this datasource is configured in JBoss (see liferay-ds.attached).

      After, I create a new database called liferay6-copy in MySql server.

      So, when I try to use the Control Panel -> Server Administration -> Data Migration, fill up the target database fields like this:
      Driver class: com.mysql.jdbc.Driver
      JDBC URL: jdbc:mysql://localhost:3306/lportal6-copy?useUnicode=true&characterEncoding=UTF-8
      JDBC User name: root
      JDBC password: root

      During migration I got an error, see text file attached.

      Debugging source code, I found the file DataSourceFactoryBean.java that has a method called createInstance(). In this method, there is a check to verify if the properties has the jndi.name key, if exists, will return a connection with JNDI, not the database specified in Data Migration page.

      A workaround is change portal-ext.properties to use JDBC instead of JNDI and restart Liferay server. And finally I can run Data Migration, but I'm having other problem.

      1. data-migration-error-stacktrace.txt
        26 kB
        Henrique Simoes de Andrade
      2. liferay-ds.xml
        0.4 kB
        Henrique Simoes de Andrade

        Activity

        Hide
        Henrique Simoes de Andrade added a comment -

        Using Liferay in JBOSS 5.0.1 Enterprise, so it isn't the bundle instalation. I forget to mention this in Environment.

        Show
        Henrique Simoes de Andrade added a comment - Using Liferay in JBOSS 5.0.1 Enterprise, so it isn't the bundle instalation. I forget to mention this in Environment.
        Hide
        Henrique Simoes de Andrade added a comment -

        I made some changes in liferay source code.

        The changes are:
        Class com.liferay.portal.dao.jdbc.util.DataSourceFactoryBean

        Created a private boolean variable called _convert: private boolean _convert;

        Public method to set the value:
        public void setConvert(boolean convert)

        { this._convert = convert; }

        Change the method createInstance():
        From: if (Validator.isNotNull(jndiName)) {
        To: if (Validator.isNotNull(jndiName) && !_convert) {

        Class com.liferay.portal.convert.ConvertDatabase
        Added this line dataSourceFactory.setConvert(true); before return dataSourceFactory.createInstance();

        These changes are in ext project, so I created a new ext-impl.jar.

        This works for me, but I'm sure that this is not the right way.

        Any idea will be much appreciated.

        Show
        Henrique Simoes de Andrade added a comment - I made some changes in liferay source code. The changes are: Class com.liferay.portal.dao.jdbc.util.DataSourceFactoryBean Created a private boolean variable called _convert: private boolean _convert; Public method to set the value: public void setConvert(boolean convert) { this._convert = convert; } Change the method createInstance(): From: if (Validator.isNotNull(jndiName)) { To: if (Validator.isNotNull(jndiName) && !_convert) { Class com.liferay.portal.convert.ConvertDatabase Added this line dataSourceFactory.setConvert(true); before return dataSourceFactory.createInstance(); These changes are in ext project, so I created a new ext-impl.jar. This works for me, but I'm sure that this is not the right way. Any idea will be much appreciated.
        Hide
        Ginson Ren added a comment -

        PASSED Manual Testing using the following steps:

        1. Add jdbc.default.jndi.name=jdbc/myds to portal-ext.
        2. Add the resource in tomcat-dir/conf/server.xml (section globalnamingresources)
        <Resource name="jdbc/myds" auth="Container" type="javax.sql.DataSource"
        username="root"
        password="root"
        driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/lportal_jndi?useUnicode=true&characterEncoding=utf8"
        maxActive="15"
        maxIdle="7"
        defaultTransactionIsolation="READ_COMMITTED"
        validationQuery="Select 1" />
        3. Add the resourceLink to tomcat-dir/conf/context.xml (inside of context element)
        <ResourceLink global="jdbc/myds" name="jdbc/myds" type="javax.sql.DataSource"/>
        4. Start the tomcat server and check if lportal_jndi is used.
        5. Create a new database "lportal6-copy".
        6. Go to Control Panel -> Server Administration -> Data Migration.
        7. Fill up the target database fields like this:
        Driver class: com.mysql.jdbc.Driver
        JDBC URL: jdbc:mysql://localhost:3306/lportal6-copy?useUnicode=true&characterEncoding=UTF-8
        JDBC User name: root
        JDBC password: root
        8. Click Execute.

        Reproduced on:
        Tomcat 7.0 + MySQL 5. Portal 6.1.20 EE GA2.

        The data migration will not successed.

        Fixed on:
        Tomcat 6.0 + MySQL 5. Portal 6.0.x GIT ID: 250f6d1f6cf327cef88c495f013c6458ed6dd816.
        Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: 367deedcee5be99f96cf6b04735546c39520ef98.
        Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 436f9d674865a34c77eda88734d2ef1963f52e38.

        The data migration will successed.

        Show
        Ginson Ren added a comment - PASSED Manual Testing using the following steps: 1. Add jdbc.default.jndi.name=jdbc/myds to portal-ext. 2. Add the resource in tomcat-dir/conf/server.xml (section globalnamingresources) <Resource name="jdbc/myds" auth="Container" type="javax.sql.DataSource" username="root" password="root" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/lportal_jndi?useUnicode=true&characterEncoding=utf8" maxActive="15" maxIdle="7" defaultTransactionIsolation="READ_COMMITTED" validationQuery="Select 1" /> 3. Add the resourceLink to tomcat-dir/conf/context.xml (inside of context element) <ResourceLink global="jdbc/myds" name="jdbc/myds" type="javax.sql.DataSource"/> 4. Start the tomcat server and check if lportal_jndi is used. 5. Create a new database "lportal6-copy". 6. Go to Control Panel -> Server Administration -> Data Migration. 7. Fill up the target database fields like this: Driver class: com.mysql.jdbc.Driver JDBC URL: jdbc:mysql://localhost:3306/lportal6-copy?useUnicode=true&characterEncoding=UTF-8 JDBC User name: root JDBC password: root 8. Click Execute. Reproduced on: Tomcat 7.0 + MySQL 5. Portal 6.1.20 EE GA2. The data migration will not successed. Fixed on: Tomcat 6.0 + MySQL 5. Portal 6.0.x GIT ID: 250f6d1f6cf327cef88c495f013c6458ed6dd816. Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: 367deedcee5be99f96cf6b04735546c39520ef98. Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 436f9d674865a34c77eda88734d2ef1963f52e38. The data migration will successed.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 13 weeks, 5 days ago

              Development

                Structure Helper Panel