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

Upgrade to 7.0 from 6.0.x: unable to upgrade Image Gallery

    Details

      Description

      Steps to reproduce it:

      1. Startup a 6.0.x portal
      2. Create an image
      3. Shutdown it
      4. Upgrade tpo 7.0 (master). Add the following properties to your portal-ext.properties if necessary:
        upgrade.processes.6012=\
            com.liferay.portal.upgrade.UpgradeProcess_6_0_12_to_6_1_0\,\
            com.liferay.portal.upgrade.UpgradeProcess_6_1_1\,\
            com.liferay.portal.upgrade.UpgradeProcess_6_2_0\,\
            com.liferay.portal.upgrade.UpgradeProcess_7_0_0
        

      You will get the following exception:

      19:05:23,999 INFO  [localhost-startStop-1][UpgradeProcess:165] Upgrading com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery
      19:05:24,137 ERROR [localhost-startStop-1][JDBCExceptionReporter:234] ERROR: column imageimpl0_.companyid does not exist_  Position: 91 [Sanitized]
      19:20:12,339 WARN  [localhost-startStop-1][UpgradeImageGallery:672] Ignoring exception for image 10307
      java.lang.NullPointerException
      	at com.liferay.portal.image.FileSystemHook.getImageAsStream(FileSystemHook.java:68)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.getHookImageAsStream(UpgradeImageGallery.java:570)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.getHookImageAsBytes(UpgradeImageGallery.java:554)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateFile(UpgradeImageGallery.java:623)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImage(UpgradeImageGallery.java:668)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImageFiles(UpgradeImageGallery.java:777)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.doUpgrade(UpgradeImageGallery.java:404)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:168)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:193)
      	at com.liferay.portal.upgrade.UpgradeProcess_6_0_12_to_6_1_0.doUpgrade(UpgradeProcess_6_0_12_to_6_1_0.java:61)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:168)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:179)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:151)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:133)
      	at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:164)
      	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:81)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:142)
      	at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:176)
      	at com.liferay.portal.events.StartupAction.run(StartupAction.java:79)
      	at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1317)
      	at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:235)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
      	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
      	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
      	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      19:20:14,276 ERROR [localhost-startStop-1][JDBCExceptionReporter:234] ERROR: column imageimpl0_.companyid does not exist_  Position: 91 [Sanitized]
      19:20:15,130 WARN  [localhost-startStop-1][UpgradeImageGallery:721] Ignoring exception for image 10306
      java.lang.NullPointerException
      	at com.liferay.portal.image.FileSystemHook.getImageAsStream(FileSystemHook.java:68)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.getHookImageAsStream(UpgradeImageGallery.java:570)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImage(UpgradeImageGallery.java:711)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImageFiles(UpgradeImageGallery.java:777)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.doUpgrade(UpgradeImageGallery.java:404)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:168)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:193)
      	at com.liferay.portal.upgrade.UpgradeProcess_6_0_12_to_6_1_0.doUpgrade(UpgradeProcess_6_0_12_to_6_1_0.java:61)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:168)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:179)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:151)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:133)
      	at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:164)
      	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:81)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:142)
      	at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:176)
      	at com.liferay.portal.events.StartupAction.run(StartupAction.java:79)
      	at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1317)
      	at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:235)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
      	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
      	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
      	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      19:20:15,131 INFO  [localhost-startStop-1][UpgradeProcess:175] Completed upgrade process com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery in 891132ms
      19:20:15,132 INFO  [localhost-startStop-1][UpgradeProcess:175] Completed upgrade process com.liferay.portal.upgrade.UpgradeProcess_6_0_12_to_6_1_0 in 894033ms
      19:20:15,138 ERROR [localhost-startStop-1][MainServlet:238] com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.NullPointerException
      com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.NullPointerException
      	at com.liferay.portal.events.StartupAction.run(StartupAction.java:85)
      	at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1317)
      	at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:235)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
      	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
      	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
      	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
      	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
      	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: 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:171)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:179)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:151)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:133)
      	at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:164)
      	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:81)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:142)
      	at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:176)
      	at com.liferay.portal.events.StartupAction.run(StartupAction.java:79)
      	... 19 more
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.NullPointerException
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:171)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:193)
      	at com.liferay.portal.upgrade.UpgradeProcess_6_0_12_to_6_1_0.doUpgrade(UpgradeProcess_6_0_12_to_6_1_0.java:61)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:168)
      	... 27 more
      Caused by: java.lang.NullPointerException
      	at com.liferay.portal.image.FileSystemHook.deleteImage(FileSystemHook.java:44)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImage(UpgradeImageGallery.java:731)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImageFiles(UpgradeImageGallery.java:777)
      	at com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.doUpgrade(UpgradeImageGallery.java:404)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:168)
      	... 30 more
      Stopping the server due to unexpected startup errors
      

      Technical notes
      The root cause is that we are using the API to get the images in com.liferay.portal.upgrade.v6_1_0.UpgradeImageGallery.migrateImage and the method return null since the field company is not created yet:

      19:05:24,137 ERROR [localhost-startStop-1][JDBCExceptionReporter:234] ERROR: column imageimpl0_.companyid does not exist_  Position: 91 [Sanitized]

      We have to avoid the use of API in upgrade methods.

        Attachments

          Activity

            People

            Assignee:
            melody.wu Melody Wu
            Reporter:
            alberto.chaparro Alberto Chaparro
            Participants of an Issue:
            Recent user:
            Esther Sanz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              4 years, 38 weeks, 4 days ago

                Packages

                Version Package
                7.0.0 Alpha 3