Fórumok

Upgrade Liferay 6 EE from SP1 to SP2

stephan t, módosítva 12 év-val korábban

Upgrade Liferay 6 EE from SP1 to SP2

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2010.10.19. Legújabb bejegyzések
Hello good People,

I recently updated a Liferay 6 EE SP1 to 6 EE SP2 and would like to share my experience (and fixes) with you, as I think it might be helpful to you as well. I used the standard Liferay upgrade process.
My environment:
a) Liferay 6 EE SP1 (totally virgin) on tomcat, mysql, windows 7
b) Liferay 6 EE SP1 on tomcat, oracle 10, linux (don’t know exactly which distribution)

The Upgrade Process:
- configure Liferay 6 EE SP2 to use the database of LR 6 SP1 and add the property upgrade.processes=\com.liferay.portal.upgrade.UpgradeProcess_6_0_12 to your portal-ext.properties
- Start Liferay (and probably see the first error messages)

My experience 1:
- The first exception I got was related to Quartz Job Details data. The scheduler runs before the upgrade but the data is not yet changed to the new code base. I ignored the exception at this point, it did not show up after the upgrade finished successfully.
- The second exception was again related to Quartz. The UpgradeSchedular class failed with the following (part of the) stack trace:
Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.io.InvalidClassException: com.liferay.portal.kernel.messaging.Message; local class incompatible: stream classdesc serialVersionUID = -1634212251253319200, local class serialVersionUID = 4711840537427854493

Now, what do we learn: a serialized object from the database cannot be de-serialized. I discovered that the implementation of the mentioned class changed and Liferay did not for any model class implement a fix serial version id.
Workaround:
Add a private static field for serialVersionUID and assign the needed serialVersionUID from the log message to Message.java, compile the class (probably by importing the source project into eclipse), and replace the Message.class in the tomcat/lib/ext/portal-services.jar by the newly compiled version.
- After the change the upgrade process ran successfully.

My experience 2:
- On environment b) (oracle database) the upgrade process for the new virtual host table failed, but didn’t tell me so. I later recognized that almost all links (e.g. the links in my_places) where converted to links without a hostname. Yes, I was as stunned as you ;-) no hostname. After debugging the ViewAction.java for my_places I figured that the UpgradeVirtualHost.java didn’t quite do its job. It was supposed to make entries based on the company table’s virtualhost column and the layoutset virtualhosts column. But it didn’t. Now why is that? Turned out that the statement that was supposed to read the old data from the database doesn’t return any rows from the oracle database (but it does for mysql). The statement ended on <<where virtualhost != ‘’>> (StringPool.BLANK was used).
Workaround:
Use the process above and replace the class UpgradeVirtualHost in the portal-impl.jar of your Liferay installation. In the class replace StringPool.BLANK by StringPool.SPACE.

A note: whenever the upgrade fails you should do a rollback of your database. Otherwise data could be touched twice by the upgrade process, and you might end up with duplicated lines in your database.

I hope this helps and Liferay addresses the problems soon. I feel that those basic upgrade behavior should have been tested and fixed before distributing a service pack. I’d say all in all I spent about 6 hours with figuring out the workarounds. 6 hours of my time and my customer’s money.

Take care and have fun.
stephan
Tami Kruger, módosítva 12 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

New Member Bejegyzések: 6 Csatlakozás dátuma: 2011.01.04. Legújabb bejegyzések
I have recompiled the Message class and now get this error. What can I do?

15:52:13,879 INFO [UpgradeProcess:207] Upgrading com.liferay.portal.upgrade.v6_0_12.UpgradeScheduler
15:52:13,911 ERROR [MainServlet:201] 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:58)
at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1284)
at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:198)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
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:213)
at com.liferay.portal.upgrade.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:103)
at com.liferay.portal.upgrade.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:56)
at com.liferay.portal.upgrade.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:36)
at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:81)
at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:48)
at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:119)
at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:144)
at com.liferay.portal.ee.license.StartupAction.doRun(Unknown Source)
at com.liferay.portal.events.StartupAction.run(StartupAction.java:52)
... 20 more
Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.lang.NullPointerException
at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:213)
at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:227)
at com.liferay.portal.upgrade.UpgradeProcess_6_0_12.doUpgrade(UpgradeProcess_6_0_12.java:57)
at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:210)
... 29 more
Caused by: java.lang.NullPointerException
at com.liferay.portal.upgrade.v6_0_12.UpgradeScheduler.getUpgradeQuartzData(UpgradeScheduler.java:136)
at com.liferay.portal.upgrade.v6_0_12.UpgradeScheduler.doUpgrade(UpgradeScheduler.java:72)
at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:210)
... 32 more
stephan t, módosítva 12 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2010.10.19. Legújabb bejegyzések
Hi Tami,

reading the last part of your stack trace it looks as if the algorithm to update existing jobs has some problems.
It looks like I'm having an older version of the source code for this class (com.liferay.portal.upgrade.v6_0_12.UpgradeScheduler) as in my line 136 there can't be any null pointer exception.
Nevertheless, if you look at the code you'll see what's going on and you could check your database for some of the values. E.g. destinationName (be careful, just a wild guess):


String destinationName = (String)jobDataMap.get(
		SchedulerEngine.DESTINATION_NAME);

if (!destinationName.equals(
		DestinationNames.LAYOUTS_LOCAL_PUBLISHER) &amp;&amp;
	        !destinationName.equals(	DestinationNames.LAYOUTS_REMOTE_PUBLISHER)) {
...


If this doesn't help, try debugging this piece of code. If you can't debug your system, you might want to set up a SP1 on your local machine and import only the QUARTZ_JOB_DETAILS table from your live system. Then connect this database to your new SP2 and try the update and debug.

Hope this helps.
Please let us know your results.
Cheers
s t
Tami Kruger, módosítva 12 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

New Member Bejegyzések: 6 Csatlakozás dátuma: 2011.01.04. Legújabb bejegyzések
I dont see a destination name field in QUARTZ_JOB_DETAILS

I am upgrading from 6.0 no SP's to 6.1 and the offending code looks like this

String destinationName = (String)jobDataMap.get(
SchedulerEngine.DESTINATION_NAME);
if (!destinationName.equals(
DestinationNames.LAYOUTS_LOCAL_PUBLISHER) &&
!destinationName.equals(
DestinationNames.LAYOUTS_REMOTE_PUBLISHER)) {

I am not sure what would happen if i comment out the line what throws the NPE. Any suggestions?
stephan t, módosítva 12 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2010.10.19. Legújabb bejegyzések
Hi Tami,

ok, that's a good hint with the version :-)

With 6.1 comes update scripts that upgrade from 6.0.12 (6.0 SP2): UpgradeProcess_6_0_12_to_6_1_0.java. In the sources you'll also find an SQL script which is dropping and creating certain tables: sql\update-6.0.12-6.1.0.sql. But you are right, there is no such column ever mentioned in any of the SQL scripts. Wonderful! :-(
Given the logic in the if-check, you want to execute the statements in the if-block if destination name is null. So I suggest to make it look like:

if ([i][b]destinationName == null || ([/b][/i]!destinationName.equals(
		DestinationNames.LAYOUTS_LOCAL_PUBLISHER) &amp;&amp;
	!destinationName.equals(
		DestinationNames.LAYOUTS_REMOTE_PUBLISHER)[i][b])[/b][/i]) {

If destinationName equals null it will jump right into the if-block, without looking at the rest of the if-check. Then of course recompile and copy to portal-impl.jar.


A note on the side: I'm not sure if you should upgrade your 6.0 to 6.0 SP2 first, before upgrading to 6.1. It will not make this problem go away, but I'm not sure about the data consistency in general without the step in between.

Good luck
s t
Tami Kruger, módosítva 12 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

New Member Bejegyzések: 6 Csatlakozás dátuma: 2011.01.04. Legújabb bejegyzések
I was able to get over the hump by dropping all the QUARTZ_ tables and letting the upgrade recreate them. This was acceptable in my situation, but probably not for everyone. Now we have a new exception...yay!

14:09:46,478 ERROR [MainServlet:201] com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLException: Invalid column name 'fileEntryId'.
com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLException: Invalid column name 'fileEntryId'.
	at com.liferay.portal.events.StartupAction.run(StartupAction.java:58)
	at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1284)
	at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:198)
	at javax.servlet.GenericServlet.init(GenericServlet.java:160)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLException: Invalid column name 'fileEntryId'.
	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:213)
	at com.liferay.portal.upgrade.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:103)
	at com.liferay.portal.upgrade.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:56)
	at com.liferay.portal.upgrade.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:36)
	at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:81)
	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:48)
	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:119)
	at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:144)
	at com.liferay.portal.ee.license.StartupAction.doRun(Unknown Source)
	at com.liferay.portal.events.StartupAction.run(StartupAction.java:52)
	... 20 more
Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLException: Invalid column name 'fileEntryId'.
	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:213)
	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:227)
	at com.liferay.portal.upgrade.UpgradeProcess_6_0_12_to_6_1_0.doUpgrade(UpgradeProcess_6_0_12_to_6_1_0.java:54)
	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:210)
	... 29 more
Caused by: java.sql.SQLException: Invalid column name 'fileEntryId'.
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1166)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1119)
	at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
	at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
	at com.liferay.portal.dao.db.BaseDB.runSQL(BaseDB.java:222)
	at com.liferay.portal.dao.db.BaseDB.runSQL(BaseDB.java:242)
	at com.liferay.portal.dao.db.BaseDB.runSQL(BaseDB.java:235)
	at com.liferay.portal.kernel.upgrade.UpgradeProcess.runSQL(UpgradeProcess.java:117)
	at com.liferay.portal.upgrade.v6_0_12_to_6_1_0.UpgradeDocumentLibrary.updateFileVersions(UpgradeDocumentLibrary.java:109)
	at com.liferay.portal.upgrade.v6_0_12_to_6_1_0.UpgradeDocumentLibrary.doUpgrade(UpgradeDocumentLibrary.java:80)
	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:210)
	... 32 more
stephan t, módosítva 12 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2010.10.19. Legújabb bejegyzések
Hi Tami,

sorry for my late reply, had some hardware problems.

I think now there is the problem that I was referring to before: Upgrade steps!
What is the right pass for a migration.
the fileEntryId field has been added to the Tabel DLFileVersion with the sql script update-6.0.6-6.0.11.sql that you can find in the Liferay 6.0 EE SP2 source bundle. You can also find it in the file update-6.0.6-6.1.0.sql of the Liferay 6.1 EE source bundle. The question rather is, when is Liferay executing this script.
You have the chance to force Liferay to run dedicated Upgrade classes. Look in the portal properties: upgrade.processes and try to execute the one that adds the respective column.
Please make sure to start from a fresh 6.0 EE Database. Upgrade to 6.0 EE SP1, then SP2, then 6.1

Good luck and happy Friday.
s t
Tami Kruger, módosítva 11 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

New Member Bejegyzések: 6 Csatlakozás dátuma: 2011.01.04. Legújabb bejegyzések
We still no luck. Based on Liferay's upgrade paths, We should be able to go directly from 6.0EE to 6.1 without installing the service packs. I need to figure out how to ensure the document library schema is upgraded before the DL upgrade process starts. Any idea?
stephan t, módosítva 11 év-val korábban

RE: Upgrade Liferay 6 EE from SP1 to SP2

Junior Member Bejegyzések: 48 Csatlakozás dátuma: 2010.10.19. Legújabb bejegyzések
Hi Tami,

have a look on the create statements for the document library tables. You'll find them in sql/portal-tables.sql of the respective sources (6.0 and 6.1).
Then browse the update-6.0....sql in your 6.1 sources for statements that take care of the differences.
Potentially you'll find some more information what Liferay wants to do in the Java classes around the UpgradeProces_6... or UpgradeDocumentLibrary.java.

What I'm still wondering: Liferay 6.0EE equals 6.0.10 I believe. However, there is no upgrade path from this version, only from 6.0 EE SP1 (6.011). I'm not having access to the 6.0.11 source. Maybe you'll find a hint for the missing piece there.

Good luck, and please share some results when you have them :-)
Have a nice weekend.
s t