留言板

[Database migration] Liferay's UpgradeProcess

Christophe Schutz,修改在11 年前。

[Database migration] Liferay's UpgradeProcess

New Member 帖子: 8 加入日期: 12-2-27 最近的帖子
Hello everyone,

we've been running into a problem today. We had to change the server on which the database was hosted, so basically we did copy all the data of the Liferay's installation (lportal database) and a custom database, each defined as a Resource in Tomcat to be usable by the portal and the apps in it.

Problem is, when we try to start up the Tomcat with Liferay in it, Liferay goes through it's UpgradeProcess even though there should be nothing to upgrade since it's a database copy which used to work. Here's a printstacktrace (translated from french) :

15:52:20,484 INFO  [UpgradeProcess:108] Upgrading com.liferay.portal.upgrade.UpgradeProcess_6_0_6
15:52:20,484 INFO  [UpgradeProcess:108] Upgrading com.liferay.portal.upgrade.v6_0_6.UpgradeSchema
15:52:20,500 WARN  [BaseDB:376] ORA-01430: the column already exists in the table: alter table JournalArticleResource add uuid_ VARCHAR(75) null;
15:52:20,515 WARN  [BaseDB:376] ORA-00955: this object already exists: create table SocialEquityGroupSetting (	equityGroupSettingId LONG not null primary key,	groupId LONG,	companyId LONG,	classNameId LONG,	type_ INTEGER,	enabled BOOLEAN);
15:52:20,515 INFO  [UpgradeProcess:108] Upgrading com.liferay.portal.upgrade.v6_0_6.UpgradeRSS
15:52:20,578 ERROR [JDBCExceptionReporter:101] ORA-01453: SET TRANSACTION must be the first instruction of the transaction

15:52:20,578 ERROR [MainServlet:202] com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.QueryTimeoutException: could not load an entity: [com.liferay.counter.model.impl.CounterImpl#com.liferay.counter.model.Counter]
com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.QueryTimeoutException: could not load an entity: [com.liferay.counter.model.impl.CounterImpl#com.liferay.counter.model.Counter]
	at com.liferay.portal.events.StartupAction.run(StartupAction.java:53)
	at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1166)
	at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:199)
	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.QueryTimeoutException: could not load an entity: [com.liferay.counter.model.impl.CounterImpl#com.liferay.counter.model.Counter]
	at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:195)
	at com.liferay.counter.service.persistence.CounterFinderImpl._obtainIncrement(CounterFinderImpl.java:388)
	at com.liferay.counter.service.persistence.CounterFinderImpl.createCounterRegister(CounterFinderImpl.java:225)
	at com.liferay.counter.service.persistence.CounterFinderImpl.createCounterRegister(CounterFinderImpl.java:177)
	at com.liferay.counter.service.persistence.CounterFinderImpl.getCounterRegister(CounterFinderImpl.java:252)
	at com.liferay.counter.service.persistence.CounterFinderImpl.increment(CounterFinderImpl.java:96)
	at com.liferay.counter.service.persistence.CounterFinderImpl.increment(CounterFinderImpl.java:88)
	at com.liferay.counter.service.persistence.CounterFinderImpl.increment(CounterFinderImpl.java:84)
	at com.liferay.counter.service.impl.CounterLocalServiceImpl.increment(CounterLocalServiceImpl.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:82)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy97.increment(Unknown Source)
	at com.liferay.portal.service.impl.ClassNameLocalServiceImpl.addClassName(ClassNameLocalServiceImpl.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:82)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy14.addClassName(Unknown Source)
	at com.liferay.portal.service.impl.ClassNameLocalServiceImpl.getClassName(ClassNameLocalServiceImpl.java:85)
	at com.liferay.portal.service.impl.ClassNameLocalServiceImpl.checkClassNames(ClassNameLocalServiceImpl.java:61)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:82)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy14.checkClassNames(Unknown Source)
	at com.liferay.portal.service.ClassNameLocalServiceUtil.checkClassNames(ClassNameLocalServiceUtil.java:236)
	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:102)
	at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:117)
	at com.liferay.portal.events.StartupAction.run(StartupAction.java:47)
	... 29 more
Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.QueryTimeoutException: could not load an entity: [com.liferay.counter.model.impl.CounterImpl#com.liferay.counter.model.Counter]
	at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
	at com.liferay.portal.dao.orm.hibernate.SessionImpl.get(SessionImpl.java:135)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
	at $Proxy234.get(Unknown Source)
	at com.liferay.counter.service.persistence.CounterFinderImpl._obtainIncrement(CounterFinderImpl.java:366)
	... 94 more
Caused by: org.hibernate.QueryTimeoutException: could not load an entity: [com.liferay.counter.model.impl.CounterImpl#com.liferay.counter.model.Counter]
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:124)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.loader.Loader.loadEntity(Loader.java:1937)
	at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
	at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
	at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3270)
	at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
	at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
	at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
	at org.hibernate.event.def.DefaultLoadEventListener.lockAndLoad(DefaultLoadEventListener.java:403)
	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:155)
	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
	at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1065)
	at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1056)
	at com.liferay.portal.dao.orm.hibernate.SessionImpl.get(SessionImpl.java:131)
	... 101 more
Caused by: java.sql.SQLException: ORA-01453: SET TRANSACTION doit être la première instruction de la transaction

	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
	at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
	at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:961)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
	at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1726)
	at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1696)
	at oracle.jdbc.driver.PhysicalConnection.setTransactionIsolation(PhysicalConnection.java:1697)
	at org.apache.tomcat.dbcp.dbcp.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:380)
	at org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setTransactionIsolation(PoolingDataSource.java:343)
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.getTargetConnection(LazyConnectionDataSourceProxy.java:414)
	at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376)
	at $Proxy4.prepareStatement(Unknown Source)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1596)
	at org.hibernate.loader.Loader.doQuery(Loader.java:717)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
	at org.hibernate.loader.Loader.loadEntity(Loader.java:1933)
	... 113 more
Stopping the server due to unexpected startup errors


Is there any way to force Liferay not to go trough this UpgradeProcess ? Does

We run on Liferay 6.0.6 on a Tomcat 6.

Thank you in advance,

Chris
thumbnail
David H Nebinger,修改在11 年前。

RE: [Database migration] Liferay's UpgradeProcess

Liferay Legend 帖子: 14914 加入日期: 06-9-2 最近的帖子
Check the value in the release_ table (only one row). It should match the version you're using, if it's not there or not the same, the upgrade process is invoked.
Christophe Schutz,修改在11 年前。

RE: [Database migration] Liferay's UpgradeProcess

New Member 帖子: 8 加入日期: 12-2-27 最近的帖子
Hello, thank you for your quick answer.

Unfortunately, I did check the value for this single-lined table, and it is strictly the same on both servers :

RELEASEID : 1
CREATEDATE : 26/09/2011 15:52:33,000000
MODIFIEDDATA : 19/04/2012 08:15:52,187000
SERVLETCONTEXTNAME : portal
BUILDNUMBER : 6006
BUILDDATE : 19/04/2012 08:15:52,187000
VERIFIED : 1
TESTSTRING : You take the blue pill, the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill, you stay in Wonderland, and I show you how deep the rabbit hole goes.


So the problem has to be elsewhere..

EDIT : On another server we migrated, the problem is somewhat different (probably related though) : Liferay boots correctly but displays the default Liferay page, just like none of our custom themes/portlets were deployed (life a fresh install). Moving back to the old server IP, our site appears again. Are there any steps for a database migration other than copying the database and setting the new jdbc resources in server.xml of Tomcat ?
thumbnail
David H Nebinger,修改在11 年前。

RE: [Database migration] Liferay's UpgradeProcess

Liferay Legend 帖子: 14914 加入日期: 06-9-2 最近的帖子
Well, there's possibly some settings in portal-ext.properties file that may have been set up, but not normally using named IP addresses.

Do you have virtual hosts set up?
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: [Database migration] Liferay's UpgradeProcess

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Check your database tables. If your new server hosting database is able to distinguish upper and lower case, it may be the case that there are tables with the same name but one using capital letters and an another will all lower case. Liferay is executing the upgrade process because it's not finding the copied tables and recreating them.

I've seen this happen in MySQL when importing database from Windows to Linux. In this case, you'll just have to set my.cnf to only use lowercase table names.
Christophe Schutz,修改在11 年前。

RE: [Database migration] Liferay's UpgradeProcess

New Member 帖子: 8 加入日期: 12-2-27 最近的帖子
Hello,

I finally fixed the problem and it had nothing to do with Liferay, we created a dump of our database and the script that imported it into the new one contained errors.

Sorry for wasting your time, and thank you for your help anyways !

Chris
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: [Database migration] Liferay's UpgradeProcess

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
So the cause of the problem was really that not all data were being imported into the new database. That'll do what you've mentioned. Glad to hear that you've got it working now. emoticon