[探索] liferay更改MySQL数据库失败

chenweiyu 2010-06-22
目前尝试将liferay更改到MySQL数据库上,但是没有成功,具体如下:

版本:liferay-portal-tomcat-5.5-5.1.2

方式:就是在liferay现有应有上,而不是ext环境下

步骤:
1、下载liferay-portal-sql-5.2.3.zip,解压后在mysql下运行
   {SQL_HOME}\create\目录下的create-mysql.sql脚本文件,创建
   liferay数据库。
2、修改D:\liferay-portal-tomcat-5.5-5.1.2\conf\Catalina\localhost
   目录下的ROOT.xml文件。
   将Hypersonic相关配置注释掉:
   <!-- Hypersonic -->

<!--<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.hsqldb.jdbcDriver"
url="jdbc:hsqldb:lportal"
username="sa"
password=""
maxActive="20"
/>-->
  
   配置MySQL:
   <!-- MySQL -->

<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;characterEncoding=UTF-8&amp;useFastDateParsing=false"
username="root"
password="123"
maxActive="20"
/>
3、拷贝mysql-connector-java-5.1.7-bin.jar驱动到
   D:\liferay-portal-tomcat-5.5-5.1.2\common\lib\路径下
4、配置MySQL的Dialect。修改
   D:\liferay-portal-tomcat-5.5-5.1.2\webapps\ROOT\WEB-INF\lib路
   径下portal-impl.jar包里的portal.properties文件:
   在hibernate配置里加上
   hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
   (因为MySQL脚本里用的是InnoDB引擎)
5、确认portal-impl.jar包里的system.properties文件里配置为
    user.country=US
   user.language=en(这个我也是帖子里看到推荐这样配置的)

完成以上工作后运行bin目录下的start.bat,控制台信息里最后虽然显示启动成功,但是中间有许多异常,:
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy92.update(Unknown Source)
        at com.liferay.portal.service.impl.RoleLocalServiceImpl.addRole(RoleLoca
lServiceImpl.java:86)
        at com.liferay.portal.service.impl.RoleLocalServiceImpl.addRole(RoleLoca
lServiceImpl.java:61)
        at com.liferay.portal.service.impl.RoleLocalServiceImpl.checkSystemRoles
(RoleLocalServiceImpl.java:156)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
e(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy90.checkSystemRoles(Unknown Source)
        at com.liferay.portal.service.impl.CompanyLocalServiceImpl.checkCompany(
CompanyLocalServiceImpl.java:274)
        at com.liferay.portal.service.impl.CompanyLocalServiceImpl.checkCompany(
CompanyLocalServiceImpl.java:122)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
e(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy22.checkCompany(Unknown Source)
        at com.liferay.portal.service.CompanyLocalServiceUtil.checkCompany(Compa
nyLocalServiceUtil.java:115)
        at com.liferay.portal.util.PortalInstances._initCompany(PortalInstances.
java:295)
        at com.liferay.portal.util.PortalInstances.initCompany(PortalInstances.j
ava:89)
        at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:429)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1139)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:96
6)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3956)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
230)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:626)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:553)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.sql.BatchUpdateException: Duplicate entry '1-0-0' for key 'IX_A8
8E424E'
        at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStateme
nt.java:1693)
        at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:
1108)
        at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(Delegati
ngStatement.java:297)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.jav
a:48)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:
246)
        ... 84 more
06:02:19,353 ERROR [BasePersistenceImpl:52] Caught ORMException
06:02:19,399 ERROR [PortalInstances:300] com.liferay.portal.SystemException: com
.liferay.portal.kernel.dao.orm.ORMException: Could not execute JDBC batch update

com.liferay.portal.SystemException: com.liferay.portal.kernel.dao.orm.ORMExcepti
on: Could not execute JDBC batch update
        at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.proce
ssException(BasePersistenceImpl.java:78)
        at com.liferay.portal.service.persistence.RolePersistenceImpl.updateImpl
(RolePersistenceImpl.java:260)
        at com.liferay.portal.service.persistence.RolePersistenceImpl.update(Rol
ePersistenceImpl.java:217)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
e(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy92.update(Unknown Source)
        at com.liferay.portal.service.impl.RoleLocalServiceImpl.addRole(RoleLoca
lServiceImpl.java:86)
        at com.liferay.portal.service.impl.RoleLocalServiceImpl.addRole(RoleLoca
lServiceImpl.java:61)
        at com.liferay.portal.service.impl.RoleLocalServiceImpl.checkSystemRoles
(RoleLocalServiceImpl.java:156)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
e(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy90.checkSystemRoles(Unknown Source)
        at com.liferay.portal.service.impl.CompanyLocalServiceImpl.checkCompany(
CompanyLocalServiceImpl.java:274)
        at com.liferay.portal.service.impl.CompanyLocalServiceImpl.checkCompany(
CompanyLocalServiceImpl.java:122)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:310)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
e(ExposeInvocationInterceptor.java:89)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy22.checkCompany(Unknown Source)
        at com.liferay.portal.service.CompanyLocalServiceUtil.checkCompany(Compa
nyLocalServiceUtil.java:115)
        at com.liferay.portal.util.PortalInstances._initCompany(PortalInstances.
java:295)
        at com.liferay.portal.util.PortalInstances.initCompany(PortalInstances.j
ava:89)
        at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:429)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1139)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:96
6)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3956)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
230)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:626)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:553)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: com.liferay.portal.kernel.dao.orm.ORMException: Could not execute JDB
C batch update
        at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(Ex
ceptionTranslator.java:41)
        at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.ja
va:90)
        at com.liferay.portal.service.persistence.RolePersistenceImpl.updateImpl
(RolePersistenceImpl.java:253)
        ... 76 more


打开浏览器输入http://localhost:8080/ ,访问不了首页,而且控制台不停翻滚异常信息。
在这里我想说明一下,这几天我都在研究liferay更改数据库的问题,从零学起,自己也在网上搜索资料解决遇到的一些问题,但是现在找不到其他有用的资料来解决这个问题,希望大家能不吝赐教,谢谢!
dhcn 2010-07-01
我上周用Resin的5.2.3 bundle,采用mysql下的精简建表方式,实现基本正常的平台运行。
Global site tag (gtag.js) - Google Analytics