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

UpgradeCompany throws ClassNotFoundException when switching from IBM java to another vendor

    Details

      Description

      Description

      When attempting to upgrade a 6.2 bundle to 7.2 that had users created while using the IBM 8 JDK, the upgrade fails with a java.lang.ClassNotFoundException for the com.ibm.crypto.provider.AESSecretKey when a different supported JDK 8 is used for the upgrade.

      Steps to Reproduce

      1. Install IBM's JDK 8 (I installed it in a separate directory from the already installed Oracle JDK 8, in preparation for step 7)
      2. Unzip a 6.2 bundle, patch it to portal-171, and set the JRE_HOME in the bundle's setenv.sh file to be the installed IBM JDK 8 (for me, JRE_HOME=/usr/lib/jvm/java-8-ibm)
      3. Connect the bundle to a MySQL database (via the portal-ext.properties file), launch the bundle, and complete the initial basic configurations
      4. Within the portal's control panel, create two test users, assigning passwords to both, then log in with one of the test users and change their password (via the required password reset, prompted at login)
      Note: While changing the password for this user, I received the following WARN in the Liferay logs:

      22:06:06,640 WARN  [http-bio-8080-exec-8][Encryptor:232] IBM JVM does not have com.sun.crypto.provider.SunJCE, using com.ibm.crypto.provider.IBMJCE instead
      

      5. Shut down the 6.2 bundle
      6. Unzip a 7.2 SP1 bundle, and patch it to dxp-3
      7. Using the included upgrade tool, started an upgrade attempt for the MySQL database from step 3 (using a different JDK 8 – I used Oracle JDK 8)

      Note: to speed up testing, I created a database dump at the end of step 5, see attached 18139upgrade-step5.dump, which can be imported locally before skipping directly to step 6, if desired.

      Results of Testing

      Expected Result: The upgrade would be able to complete without issue
      Actual Result: The upgrade fails during the com.liferay.portal.upgrade.v7_0_1.UpgradeCompany#updateCompanyKey step and fully exits the Gogo shell.

      Errors/Logs

      2020-01-13 22:24:29.086 INFO  [main][UpgradeProcess:107] Completed upgrade process com.liferay.portal.upgrade.v7_0_1.UpgradeSchema in 18 ms
      2020-01-13 22:24:29.086 INFO  [main][UpgradeProcess:93] Upgrading com.liferay.portal.upgrade.v7_0_1.UpgradeCompany
      2020-01-13 22:24:29.087 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.upgrade.v7_0_1.UpgradeCompany#updateCompanyKey
      2020-01-13 22:24:29.099 ERROR [main][Base64:343] java.lang.ClassNotFoundException: com.ibm.crypto.provider.AESSecretKey
      java.lang.ClassNotFoundException: com.ibm.crypto.provider.AESSecretKey
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:348)
      	at com.liferay.petra.lang.ClassResolverUtil.resolve(ClassResolverUtil.java:29)
      	at com.liferay.portal.kernel.io.ProtectedObjectInputStream.doResolveClass(ProtectedObjectInputStream.java:52)
      	at com.liferay.portal.kernel.io.ProtectedObjectInputStream.resolveClass(ProtectedObjectInputStream.java:65)
      	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1868)
      	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1751)
      	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2042)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
      	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
      	at com.liferay.portal.kernel.util.Base64._stringToObject(Base64.java:339)
      	at com.liferay.portal.kernel.util.Base64.stringToObject(Base64.java:87)
      	at com.liferay.portal.upgrade.v7_0_1.UpgradeCompany.updateCompanyKey(UpgradeCompany.java:49)
      	at com.liferay.portal.upgrade.v7_0_1.UpgradeCompany.doUpgrade(UpgradeCompany.java:35)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:96)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:141)
      	at com.liferay.portal.upgrade.UpgradeProcess_7_0_1.doUpgrade(UpgradeProcess_7_0_1.java:41)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:96)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:173)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:140)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:122)
      	at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:154)
      	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:85)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:174)
      	at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:105)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:55)
      2020-01-13 22:24:29.106 INFO  [main][LoggingTimer:43] Completed com.liferay.portal.upgrade.v7_0_1.UpgradeCompany#updateCompanyKey in 19 ms
      2020-01-13 22:24:29.106 INFO  [main][UpgradeProcess:107] Failed upgrade process com.liferay.portal.upgrade.v7_0_1.UpgradeCompany in 20 ms
      2020-01-13 22:24:29.107 INFO  [main][UpgradeProcess:107] Failed upgrade process com.liferay.portal.upgrade.UpgradeProcess_7_0_1 in 39 ms
      com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.NullPointerException
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:101)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:173)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:140)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:122)
      	at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:154)
      	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:85)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:174)
      	at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:105)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:55)
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.NullPointerException
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:101)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:141)
      	at com.liferay.portal.upgrade.UpgradeProcess_7_0_1.doUpgrade(UpgradeProcess_7_0_1.java:41)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:96)
      	... 12 more
      Caused by: java.lang.NullPointerException
      	at com.liferay.petra.encryptor.Encryptor.serializeKey(Encryptor.java:231)
      	at com.liferay.portal.upgrade.v7_0_1.UpgradeCompany.updateCompanyKey(UpgradeCompany.java:51)
      	at com.liferay.portal.upgrade.v7_0_1.UpgradeCompany.doUpgrade(UpgradeCompany.java:35)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:96)
      	... 15 more
      

      Master

      Hash#: 9abb6e6c8b7bbc79929edee3cbf650db27bcf77a

      Branch

      Reproduced.
      Hash#: 5ad5e97b2bfbb1072eda9394184fcba2631b0383

      * Please see Zendesk Support tab for further comments and attachments.

        Attachments

          Activity

            People

            Assignee:
            victor.ware Victor Ware
            Reporter:
            samuel.ziemer Sam Ziemer
            Participants of an Issue:
            Recent user:
            Tomáš Polešovský
            Engineering Assignee:
            Sam Ziemer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              44 weeks, 1 day ago

                Packages

                Version Package
                7.2.10 DXP FP5
                7.2.10.2 DXP SP2
                7.2.X
                7.3.0 CE GA1
                7.3.1 CE GA2
                7.3.2 CE GA3
                7.3.10 DXP GA1
                Master