1

我已经下载了带有 tomcat 的 liferay6 包。我需要将 liferay 数据库更改为 mysql 数据库。我在谷歌中搜索过,根据信息,我用下面的代码行创建了 portal-ext.properties。

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=root123
jdbc.default.jndi.name=jdbc/LiferayPool
schema.run.enabled=true
schema.run.minimal=true

我修改了 ROOT.xml。现在该文件中的代码是:

<Context path="" crossContext="true">

<Resource
    name="jdbc/LiferayPool"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8"
    username="root"
    password="root123"
    maxActive="20"
/> 
</Context>

我已经在 mysql 中创建了 lportal 数据库。我还需要修改什么吗。如果我这样做,我什至看不到 liferay 的默认登录页面。谁能指出我做错的地方。谢谢。

如果我这样做,我会收到以下异常。

java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at java.net.Socket.<init>(Socket.java:425)
    at java.net.Socket.<init>(Socket.java:241)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2744)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:148)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)




org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.spring.aop.ServiceBeanAutoProxyCreator#0' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'serviceAdvice' while setting bean property 'methodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'asyncAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'asyncAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'threadLocalCacheAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'threadLocalCacheAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'bufferedIncrementAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bufferedIncrementAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'indexableAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexableAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'transactionAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'liferayTransactionManager' while setting bean property 'platformTransactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayTransactionManager' defined in class path resource [META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'liferayHibernateSessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayHibernateSessionFactory' defined in class path resource [META-INF/hibernate-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:710)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:410)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:172)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    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:1585)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
4

2 回答 2

1

1-更新java连接器驱动

确保 liferay 门户没有启动!如果是,则关闭。

下载并安装 MySQL 和 HeidiSQL,您可以通过 HeidiSql 简单地创建 mysql 数据库。

从dev.mysql.com下载 mysql.jar (Connector/J) 您可能无法登录,只需进入页面下方并单击链接:不,谢谢,开始我的下载。

删除 liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\lib\ext 中mysql.jar

在\Program Files(x86)\MySQL\Connector J文件夹中复制 mysql-connector-java- some version -bin.jar 和

将其粘贴到 liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\lib\ext 中。(不要忘记将其重命名为 mysql.jar)

2-使用liferay的控制面板 现在你可以启动liferay门户

在浏览器 localhost:8080/ 中打开 -> 控制面板 -> 服务器管理 -> 数据迁移

JDBC驱动类名: com.mysql.jdbc.Driver

JDBC URL: jdbc:mysql://localhost:3306/ DB-NAME ?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false

DB-NAME - 您之前创建的数据库的名称。

写入 MySQL 用户名和密码,然后单击下面的按钮。

现在在下一页您可以在*red 边框中看到一些文字*like :系统目前正在维护中。请稍后再试。

没关系。只是等待..可能是半小时或更多或更少,只是等待,耐心等待))

在进行过程中,您可以执行下一步:

3- 更改门户属性在liferay-portal-6.1.1-ce- ga2 \tomcat- 7.0.27 \webapps\ROOT\WEB-INF\classes 和将以下文本粘贴到此文件:

jdbc.default.driverClassName=com.mysql.jdbc.Driver

jdbc.default.url=jdbc:mysql://localhost:这里必须是DB端口,默认是3306 /* DB_NAME* ?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false

jdbc.default.username= MySQL 用户的用户名

jdbc.default.password= MySQL 用户密码

而已

重启Tomcat服务器

于 2013-11-08T06:00:33.270 回答
0

在您的portal-ext.properties文件中,如果您指定要查找的 JNDI 名称就足够了。

jdbc.default.jndi.name=MyDataSource

在你的 Tomcat 的 xml 文件中,

<Resource
    name="MyDataSource"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8"
    username="root"
    password="root123"
    maxActive="20"
/> 

确保您在上面使用的用户(root)具有创建表的权限。

另外,不要忘记重新启动 Tomcat 容器。

即使在此之上,如果它不起作用,请在您的 (bin) 日志中共享异常。

于 2013-01-01T11:37:50.793 回答