Wiki

Main | Proposals

Database Configuration

Liferay can be configured to use many different databases. For this example we will change the default database (Hypersonic) of the Liferay-Tomcat bundle to point to a MySQL database

Configuration

Liferay v5.2 and later

Liferay v5.2 unifies the configuration of the database in a single file for all application servers. As most other configuration options you can set this up in the portal-ext.properties file as follows (example for MySQL):

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=

Since 5.2.2 one can again use the connection pools provided by the application server by specifying the JNDI name to be used in portal-ext.properties using the following property:

jdbc.default.jndi.name=jdbc/LiferayPool

This will re-establish the way connections are handled to the behaviour of version 5.1.x

If you do not have an existing portal-ext.properties file, you can create one and save it to:

{liferay-home}\{tomcat}\webapps\ROOT\WEB-INF\classes

for Tomcat. (To find out where to put portal-ext.properties for other app servers, please refer to the Portal Administrator's Guide.)

The portal.properties file has examples for all the main databases supported. However, if you are using the bundled / download version of Liferay (instead of building from source), you will not be able to find portal.properties in your installation. (Refer to page 127 of the Portal Administrator's Guide Second Edition for an explanation why this is the case.) Instead, you can find a copy of portal.properties here for reference:

http://svn.liferay.com/repos/public/portal/branches/5.2.x/portal-impl/src/portal.properties

Again, once you've referenced portal.properties to understand what settings are available, make the appropriate additions to your portal-ext.properties file.

Note that this system uses the apache commons pool for pooling connections to the database. If you prefer to use the pooling mechanism provided by the portal application server you can still do that through spring. In particular add this to the ext-spring.xml file:

<bean id="liferayDataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
       <property name="targetDataSource">
               <bean
class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean">
                       <property name="jndiName" value="jdbc/LiferayPool" />
               </bean>
       </property>
</bean>

This file can be found in your extension environment. If you are not using this environment just create an Spring configuration file with that name and add it to the META-INF dir of your installation.

For MySql, make sure you create the database first;

create database lportal character set utf8;

Liferay v5.1 and previous

In Liferay v5.1 and previos versions the configuration was specific for each application server. This section explains how to do the configuration for tomcat by modifying the ROOT.xml file. For other application servers please check their documentation.

ROOT.xml can be found in tomcat\conf\Catalina\localhost\ROOT.xml. for reference, at the end of this article I have included an excerpt of ROOT.xml from Liferay 4.3.x

Notice there are sample entries in this file for many different databases. By default, Liferay uses Hypersonic (lightweight db used for development purposes). Notice that all entries are commented out except for the Hypersonic entry. Since we want to change Liferay to point to MySQL, we will simply

1) comment out the Hypersonic entry,

	<!-- Hypersonic -->

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

2) and uncomment the MySQL entry (or which ever entry you need for your database).

	<!-- MySQL -->

	<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=""
		password=""
		maxActive="20"
	/>

make sure that you change the value for url to point to your MySQL database url, and also fill in a username and password.

Including the JDBC driver

The next step is to make sure that tomcat has the appropriate JDBC driver so that it can 'talk' to this database. You can find these drivers online, however, for your convenience, we have included the MySQL driver (along with many others) in the portal code at the following path:

portal\lib\development\mysql.jar

For Liferay 5.1.1, if you are using Oracle 9i, then there are some issues with ojdbc14.jar. Instead of that use other jars like ojdbc14_g.jar for connecting to database.

If we are..

  • developing in the EXT environment, we need to copy the JDBC driver to this path:
    • ext\ext-lib\global\mysql.jar
  • developing directly from Portal Core (not recommended), copy the driver here:
    • portal\lib\global\mysql.jar
  • only using the Tomcat bundle, copy the driver here:
    • tomcat\common\lib\ext\mysql.jar

Creating the database and tables

You will first need to create the database, make sure that this matches the value in the url of your ROOT.xml.

For most versions of Liferay, you will have 2 sets of sql scripts, one which will create the Liferay tables with sample data (the Liferay public website) or with just the bare minimal data. You can find both sets of scripts in the portal code:

portal\sql\portal\portal-mysql.sql

and

portal\sql\portal-minimal\portal-minimal-mysql.sql

If you..

Manually creating the table

Run the appropriate script against your database.

Automatically creating the tables

Starting in 4.3, you only need to create the database and Liferay will automatically run the appropriate script to create all the necessary tables for you.

in portal.properties, there is a property that you can set which will determine if the portal will create a minimal version of Liferay or a version which is pre-populated with sample data.

##
## Schema
##

    #
    # Set this to true to automatically create tables and populate with default
    # data if the database is empty.
    #
    schema.run.enabled=true

    #
    # Set this to to true to populate with the minimal amount of data. Set this
    # to false to populate with a larger amount of sample data.
    #
    schema.run.minimal=false

If you wanted Liferay to automatically create only the necessary Liferay tables for you, then add the following values in your portal-ext.properties (tomcat\webapps\ROOT\WEB-INF\classes\portal-ext.properties)

    schema.run.enabled=true
    schema.run.minimal=true

Reference

excerpt of ROOT.xml in 4.3.x

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

	<!-- DB2 -->

	<!--<Resource
		name="jdbc/LiferayPool"
        auth="Container"
        type="javax.sql.DataSource"
        driverClassName="com.ibm.db2.jcc.DB2Driver"
        url="jdbc:db2:lportal"
        username="db2admin"
        password="lportal"
        maxActive="20"
	/>-->

	<!-- Derby -->

	<!--<Resource
		name="jdbc/LiferayPool"
		auth="Container"
		type="javax.sql.DataSource"
		driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
		url="jdbc:derby:lportal"
		username=""
		password=""
		maxActive="20"
	/>-->

	<!-- 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 -->

	<!--<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=""
		password=""
		maxActive="20"
	/>-->

	<!-- Oracle -->

	<!--<Resource
		name="jdbc/LiferayPool"
		auth="Container"
		type="javax.sql.DataSource"
		driverClassName="oracle.jdbc.driver.OracleDriver"
		url="jdbc:oracle:thin:@localhost:1521:orcl"
		username="lportal"
		password="lportal"
		maxActive="20"
	/>-->

	<!-- P6Spy -->

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

	<!-- PostgreSQL -->

	<!--<Resource
		name="jdbc/LiferayPool"
		auth="Container"
		type="javax.sql.DataSource"
		driverClassName="org.postgresql.Driver"
		url="jdbc:postgresql://localhost:5432/lportal"
		username="sa"
		password=""
		maxActive="20"
	/>-->

	<!-- SQL Server -->

	<!--<Resource
		name="jdbc/LiferayPool"
		auth="Container"
		type="javax.sql.DataSource"
		driverClassName="net.sourceforge.jtds.jdbc.Driver"
		url="jdbc:jtds:sqlserver://localhost/lportal"
		username="sa"
		password=""
		maxActive="20"
	/>-->

	<!-- Sybase -->

	<!--<Resource
		name="jdbc/LiferayPool"
		auth="Container"
		type="javax.sql.DataSource"
		driverClassName="net.sourceforge.jtds.jdbc.Driver"
		url="jdbc:jtds:sybase://localhost:5000/lportal"
		username="sa"
		password=""
		maxActive="20"
	/>-->

Tomcat with SQL Server 2008

Building and Installing Liferay Source Code on Glassfish v2 and MySQL

Sybase configuration for Liferay

DB2 Express-C 9.5 on CentOS 5.2

Derby with Glassfish

PostgreSQL with Glassfish

Derby Java DB RDBMS

91378 Views , 0 Attachments 0 Attachments

Average (0 Votes)
Comments Flat View

Hi,

I have been googling and reading the wiki and posts. I downloaded the 5.2.1 version of liferay with both tomcat 5.5 and 6. I can't figure out what file to create or edit to have liferay use mysql instead of hypersonic. I have read alot about a portal(-ext). file to create. Does anyone have an example and what directory to put in? Sorry i am more of DBA than Java developer.

Liferay v5.2 unifies the configuration of the database in a single file for all application servers. As most other configuration options you can set this up in the portal(-ext).properties file as follows (example for MySQL):

I see this from above where do i put it. Is there a way to get those sample files?

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=

Thanks,

Jon

PS. I got it working with hypersonic is real simple..... emoticon

Posted on 2/20/09 10:05 AM.

Top Top
I am also having a problem.

I interpreted the instructions above as "...if this file does not exist then create it using....".

So I did however it doesn't seem to work.

Any answers out there?

Posted on 2/20/09 1:03 PM in reply to Jon Goldberg.

Top Top
For MySql, make sure the database exist. It does not need to be populated, just needs to exist.
{{{
create database lportal521 character set utf8;
}}}

Posted on 2/20/09 3:04 PM in reply to Jon Goldberg.

Top Top
I have been reading the Wiki and I'm confused!!!! I can't find the portal.properties in 5.2 to save my life. Quoting.... "The portal.properties file has examples for all the main databases supported. " I'm unable to get this to attach to MySQL When I try to run Liferay with a MySQL configuration, I get a Tomcat 404 error message. I seem to be missing some vital file but I'll be damned if I know what it is or where to find it. I'm not that familiar with your product but I've been googling like mad and still can't come up with anything. Surely this product isn't so retarded that I can't set the database connection from an XML file. Or wait... I think that is what I'm seeing... I have to use ant and rebuild it get it to talk to a "real" database.

Posted on 2/23/09 1:11 PM.

Top Top
Hello Lisa,

Unfortunately, this article assumes that the reader has certain information that the article itself does not provide.

Please take a look at our Liferay Portal Administrator's Guide here: http://www.liferay.com/web/guest/community/documentation/5_1. On page 127, there is a description of what the portal.properties file is, where to find it, and how to extend it using your own portal-ext.properties file. The file in the 5.2 version of the portal does indeed have examples for the various databases, and you can use that as a template in your portal-ext.properties file to connect to your database of choice.

Hope this helps!

--Rich

Posted on 2/24/09 3:43 PM in reply to Lisa Simpson.

Top Top
Lisa, also wanted to let you know the Wiki article has been updated with a direct link to portal.properties in SVN. That way you can reference it and then add the properties you want to override in your portal-ext.properties.

Posted on 2/24/09 3:51 PM in reply to Lisa Simpson.

Top Top
Hi Lisa,

For the MySql connect, you need to create a new blank file and name it "portal-ext.properties" and put it in the "{liferay-home}\{tomcat}\webapps\ROOT\WEB-INF\classes" folder.

Cheers,

Jerry Niu

Posted on 2/27/09 12:23 PM in reply to Lisa Simpson.

Top Top
I've noticed that, since I'm using a very recent build of MySQL, the driver provided by LifeRay gave me errors regarding being unable to identify a dialect / unable to get a connection to the backing DB. Using the most recent connector from MySQL fixed this problem.

Posted on 3/1/09 6:50 PM.

Top Top
I tried the technique above -
{liferay-home}\tomcat-5.5.27\webapps\ROOT\WEB-INF\classes\portal-ext.properties, but the startup did not seem to pick it up (it still reported Hypersonic being used).

I did the following: unzip portal-impl.jar > comment out the Hypersonic section > edit portal.properties to include a section for MySql > zipped back up > copied to {liferay-home}\tomcat-5.5.27\webapps\ROOT\WEB-INF\lib > the startup now finds my empty MySql database, populates it, and all is good.

Regards, Tom W.

Posted on 3/2/09 12:32 PM in reply to Jerry Niu.

Top Top
This seems to work, I removed the HSQL reference in the portal.properties and left mysql in the portal-ext.properties and it is using Mysql.

One thing though is that the log still contains a reference to HSQL on startup if I tail -f catalina.out but when I checked it wasn't using any HSQL resources.

Posted on 3/2/09 8:39 PM in reply to Tom Wackerfuss.

Top Top
It would be a cache issue in the Tomcat.

It would be helpful: before restarting the Tomcat, remove folders /temp and /work.

Posted on 3/6/09 2:16 PM in reply to Tom Wackerfuss.

Top Top
I downloaded the 5.2.2. Bundled with Tomcat 5.5 and followed the instructions at
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Quick+Installation+Instructions

I'm running it on Windows, and I'm getting this error:

SEVERE: Job (DEFAULT.listImagesJobDetail threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exc
eption: org.springframework.transaction.CannotCreateTransactionException: Could
not open JDBC Connection for transaction; nested exception is java.sql.SQLExcept
ion: Connections could not be acquired from the underlying database!]

So Liferay can't find it's own embedded HSQL db?

Posted on 3/10/09 3:59 PM.

Top Top
Does Liferay generate any logs by default? I'm not seeing any .log or .out files.

Posted on 3/10/09 4:38 PM.

Top Top
Seems like I still get this Msg:

23:18:30,686 WARN [DialectDetector:79] Liferay is configured to use Hypersonic
as its database. Do NOT use Hypersonic in production. Hypersonic is an embedded
database useful for development and demo'ing purposes. The database settings can
be changed in portal.properties.

But when I check the logs of the MySQL DB, it seems to be using this instead of the HSQL. Is this log message suppose to display regardless?

Posted on 3/30/09 4:41 PM.

Top Top
Rich,

I am using the jBoss-tomcat- 5.0.0 bundle and at the top it says "To find out where to put portal-ext.properties for other app servers, please refer to the Portal Administrator's Guide." but I can't seem to find anything about where to put this file in JBoss. Also Is the process the same for changing out the database. In a normal JBoss installation there are a few other places that I would modify, so I'm not sure exactly what to do. Any help would be greatly appreciated. Thanks

Posted on 4/1/09 8:16 AM in reply to Rich Sezov.

Top Top
The first part of configuring liferay to use MySQL is pretty straightforward. Just create the file (portal-ext.properties) and override the JDBC settings.

The next step, porting the existing data from HSQL as we have created alot of content, involved going into the script for HSQL (lportal.script) and pulling out all the insert statements and running them against the MySQL database. I was able to run all of the inserts successfully (4458) in all (ran a mass search&replace to put a trailing semicolon). After I ran this and went into the product, I experienced an issue. When I log in as our test user and go to the portlet pages, I get a white screen. I also tried logging in as Bruno Admin (the delivered admin account) and am able to see our content, but the screen layout isn't set right. I also noticed an error in the tomcat console: com.liferay.portal.kernel.xml.DocumentException: Error on line 1 of document : Content is not allowed in prolog.

Through the course of this effort, I had set the parameters in the portal.properties to recreate the initial database that liferay starts with (2200 insert statements). So through our customization, we more than doubled the data.

To recap the HSQL - MySQL process:
(1) Go into the folder C:\liferay-portal-5.2.2\tomcat-5.5.27\webapps\ROOT\WEB-INF\classes\
(2) Create a file: portal-ext.properties
(3) add this content to this file:
schema.run.enabled=true
schema.run.minimal=true
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=lportal
jdbc.default.password=thepassword
(4) Create an empty database called lportal
(5) Start liferay. This will populate the database with all the tables (147) and insert data into them.
(6) Empty the data. This can be done by selecting all the tables in phpmyadmin and selecting "Empty" from the dropdown.
(7) Open the file C:\liferay-portal-5.2.2\data\hsql\lportal.script and find the first INSERT statment.
(8) Select from here on down to the end of the file and copy/paste this into a new file.
(9) Add a semicolon to the end of each insert statement. This can be done by search&replace close-parens followed by CR with close-parens semicolon CR -- ')CR' with ');^p' (^p is the ultraedit symbol for CR)
(10) import this into MySQL into the emptied database.

Posted on 4/22/09 10:07 PM in reply to Brian Holland.

Top Top
Excellent! was googling & pulling my hair out trying to get this to work!

here's what worked for my postgres connection on tomcat 6/ liferay 5.2.2

jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://localhost:5432/lportal
jdbc.default.username=liferay
jdbc.default.password=password

Posted on 5/4/09 4:25 AM.

Top Top
Is there a way to keep using ROOT.xml instead portal-ext.properties for database settings? I find that, since portal-ext.properties is inside webapps/, working with many environments is quite annoyin. When we do a release, we just deploy webapps and lib/ext, and we have many common-for-all-environments properties in portal-ext.properties.

Posted on 5/7/09 1:33 AM.

Top Top
Hi, nothing is commented about the wol-portlet configuration.

To fully change HSQL database to a production database, I had to create a file inside wol-portlet/web-inf/classes/jdbc.properties and this properties
jira.driverClassName
jira.url
jira.username
jira.password
as explained here:
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2102487#_19_message_2112549

Posted on 5/18/09 10:15 AM.

Top Top
sorry, the file should be at wol-portlet/web-inf not inside classes

Posted on 5/18/09 10:35 AM in reply to Luis Mas.

Top Top
and as wol tables are created in lportal schema (in mysql is where we tested), jira.url should refer to lportal schema (or the schema where wol_ tables are).

Posted on 5/18/09 11:45 AM in reply to Luis Mas.

Top Top
Hi All

I am unable to do the DB migration.

My target database is INGRES.

I tried running the schema directly, but that does not work too and needs lot of modification. Tried searching the code but looks like there is no help for Ingress nor a Util class for Ingress in com\liferay\portal\tools\sql\ folder of portal-impl.jar.

When I point to Ingres database, server says that there is no table called repository_
Stacktrace is provided below..

Please help

here are my portal-ext.property entries.
------------------------------------
schema.run.enabled=true
schema.run.minimal=true
jdbc.default.driverClassName=com.ingres.jdbc.IngresDriver
jdbc.default.url=jdbc:ingres://hic-pcs4330:II7/lportal
jdbc.default.username=atonce_user
jdbc.default.password=satyam@123
hibernate.dialect=org.hibernate.dialect.IngresDialect

STACKTRACE from Console
-----------------------------------------
10:21:27,536 INFO [PortalImpl:243] Portal lib directory /D:/liferay-portal-5.2.2/tomcat-6.0.18/webapps/ROOT/WEB-INF/lib
/
10:21:46,581 INFO [DBUtil:116] Using dialect org.hibernate.dialect.IngresDialect
10:21:47,737 INFO [DBUtil:116] Using dialect org.hibernate.dialect.IngresDialect
10:21:47,768 ERROR [QuartzSchedulerEngineImpl:93] Unable to initialize engine
com.liferay.portal.SystemException: java.lang.NullPointerException
at com.liferay.portal.service.impl.QuartzLocalServiceImpl.checkQuartzTables(QuartzLocalServiceImpl.java:44)
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:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:

..............
10:21:47,971 INFO [ServerDetector:104] Detected server tomcat
Starting Liferay Portal Standard Edition 5.2.2 (Augustine / Build 5202 / February 20, 2009)
10:21:52,565 INFO [ReleaseLocalServiceImpl:95] Create tables and populate with default data
10:21:52,565 INFO [DBUtil:116] Using dialect org.hibernate.dialect.IngresDialect
10:21:52,565 ERROR [ReleaseLocalServiceImpl:159] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.service.impl.ReleaseLocalServiceImpl.createTablesAndPopulate(ReleaseLocalServiceImpl.java:
143)
at com.liferay.portal.service.impl.ReleaseLocalServiceImpl.getBuildNumberOrCreate(ReleaseLocalServiceImpl.java:9
8)

Posted on 5/20/09 3:23 AM.

Top Top
INGRES Database problem; in migration

// SORRY FOR DUPLICATE ENTRY //
I am unable to do the DB migration.

My target database is INGRES.

I tried running the schema directly, but that does not work too and needs lot of modification. Tried searching the code but looks like there is no help for Ingress nor a Util class for Ingress in com\liferay\portal\tools\sql\ folder of portal-impl.jar.

When I point to Ingres database, server says that there is no table called repository_
Stacktrace is provided below..

Please help

here are my portal-ext.property entries.
------------------------------------
schema.run.enabled=true
schema.run.minimal=true
jdbc.default.driverClassName=com.ingres.jdbc.IngresDriver
jdbc.default.url=jdbc:ingres://hic-pcs4330:II7/lportal
jdbc.default.username=atonce_user
jdbc.default.password=satyam@123
hibernate.dialect=org.hibernate.dialect.IngresDialect

STACKTRACE from Console
-----------------------------------------
10:21:27,536 INFO [PortalImpl:243] Portal lib directory /D:/liferay-portal-5.2.2/tomcat-6.0.18/webapps/ROOT/WEB-INF/lib
/
10:21:46,581 INFO [DBUtil:116] Using dialect org.hibernate.dialect.IngresDialect
10:21:47,737 INFO [DBUtil:116] Using dialect org.hibernate.dialect.IngresDialect
10:21:47,768 ERROR [QuartzSchedulerEngineImpl:93] Unable to initialize engine
com.liferay.portal.SystemException: java.lang.NullPointerException
at com.liferay.portal.service.impl.QuartzLocalServiceImpl.checkQuartzTables(QuartzLocalServiceImpl.java:44)
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:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:

..............
10:21:47,971 INFO [ServerDetector:104] Detected server tomcat
Starting Liferay Portal Standard Edition 5.2.2 (Augustine / Build 5202 / February 20, 2009)
10:21:52,565 INFO [ReleaseLocalServiceImpl:95] Create tables and populate with default data
10:21:52,565 INFO [DBUtil:116] Using dialect org.hibernate.dialect.IngresDialect
10:21:52,565 ERROR [ReleaseLocalServiceImpl:159] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.service.impl.ReleaseLocalServiceImpl.createTablesAndPopulate(ReleaseLocalServiceImpl.java:
143)
at com.liferay.portal.service.impl.ReleaseLocalServiceImpl.getBuildNumberOrCreate(ReleaseLocalServiceImpl.java:9
8)

Posted on 5/20/09 3:25 AM.

Top Top
Using Oracle I need to have a databse with an UTF-8 character encoding ? What happen if I have a databse with a single byte character encoding (ISO8859-1)?

Posted on 5/22/09 1:04 AM.

Top Top
404 error when going to http://hostname:8080/ with Portal 5.2.3/Tomcat 6 and MySQL:

I downloaded and unpacked the 5.2 portal bundle with tomcat 6. I can start the default install (embedded Demoticon and access it without issue.

I created the portal-ext.properties file in "{liferay-home}\{tomcat}\webapps\ROOT\WEB-INF\classes" as referenced above.

In the portal-ext.properties file I have:

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=lportal
jdbc.default.password=password

The database and user were created as required.

When I access htttp://myhost:8080 I get a 404 error. If I remove the portal-ext.properties file, it works again.

What am I missing or doing wrong?

Thanks - GG

Posted on 5/22/09 10:58 AM.

Top Top
I am having the same problem with Tomcat 5.5. Starting Tomcat 5.5 generates several exceptions after "Starting Spring root WebApplication context"

Posted on 5/27/09 12:04 PM in reply to general grant.

Top Top
I'm trying to migrate from 5.1.2 to 5.2.3. After providing the portal-ext.properties to convert from hypersonic
to my existing msql, I'm getting the following error. I assume I no longer need the mysql resource entry in ROOT.xml, like in previous versions. What about the mail resource entry?

What could be the problem? I've been succesfully running with
mysql on 5.1.2.


18:15:50,333 INFO [DBUtil:501] Database does not support case sensitive queries
18:15:50,350 ERROR [OpenSSOFilter:139] javax.servlet.ServletException: java.lang.RuntimeException: java.io.IOException: Cannot create directory: /usr/local/data/lucene/0
javax.servlet.ServletException: java.lang.RuntimeException: java.io.IOException: Cannot create directory: /usr/local/data/lucene/0
at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:166)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)

Posted on 6/7/09 11:26 AM.

Top Top
I also seem to be getting
oading file:/Volumes/Shared/webappsrv/liferay-portal-5.2.3/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes/portal-ext.properties
18:28:33,462 ERROR [DataSourceFactoryBean:71] Unable to lookup jdbc/LiferayPool
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)

Posted on 6/7/09 11:29 AM in reply to Wayne Christian.

Top Top
Hello Guys,

I am new bee to Liferay, I just yesterday downloaded and fiddled with the latest Liferay_Tomcat portal bundle Standard Edition (liferay-portal-tomcat-6.0-5.2.3).

I had same issues with MySQL on my local machine as you all have. After going through all the comments here on this thread i found user "Tom Wackerfuss" suggestions gave the success to configure Liferay with MySQL. Thank you Tom. Here are the steps i have performed to make it work with the latest SE.

1. Like Tom said unzip the portal-impl.jar and make 2 changes to portal.perperties file as below.
a. Comment HSQL properties.
b. Uncomment MySQL properties, add userID & Password values and save the file.
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=<DBconnection_USER_ID>
jdbc.default.password=<BDConnection_PWD>

2. Make a jar file with all the original contents and changed portal.properties file. DON'T USE ZIP TOOL as i did and that jar file doesn't work. USE THE BELOW Command
1. jar cf portal-impl.jar *.*

3. Place this jar file back in where it belongs i.e. {liferay-home}\tomcat-5.5.27\webapps\ROOT\WEB-INF\lib

4. I didn't make chages to any other files like ROOT.XML or portal-ext.properties. You don't need to make changes in ROOT.XML to reflect database you want to point to in the 5.2.3 version this is what i found.

5. Start the server.

that is it .
Mallinarc

Posted on 6/7/09 5:00 PM.

Top Top
Thanks Ramesh, it worked perfectly. Even though I tried it on the liferay-portal-tomcat-5.5-5.2.2 bundle.

Posted on 6/11/09 2:57 PM in reply to Ramesh C Mallina.

Top Top
It is not as complicated as it appears in this document. I have blogged my configuration steps here:

http://www.soapractice.com/web/guest/home/-/asset_publisher/m0AI/blog/liferay-glassfish-web-space-production-db-setup?redirect=%2Fweb%2Fguest

2 crucial steps:

# Create a text file named portal-ext.properties
# Add an entry in the properties file:
jdbc.default.jndi.name=jdbc/LiferayPool
#Edit the file liferay xxx/tomcat xxx/conf/Catalina/localhost/ROOT.xml. Add the following section. Note that this has to be placed between the <Context> </Context> tag
<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/yourDBName?useUnicode=true&amp;characterEncoding=UTF-8"
username="yourUserName"
password="yourPassword"
maxActive="20"
/>

Posted on 6/17/09 2:33 PM in reply to Jon Goldberg.

Top Top
hwat about Oracle

Posted on 7/6/09 1:45 AM.

Top Top
What is the effect of having empty values for
jdbc.default.username=
jdbc.default.password=
?
I assume that the database creation works, but who is the default user, or is it the anonymous user? In the article

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Building%20and%20Installing%20Liferay%20Source%20Code%20on%20Glassfish%20v2%20and%20MySQL

the suggestion is

Login to MySQL as 'root' and create database lportal;
use lportal;
create user lportal;
set password for 'lportal'@'localhost' = password('lportal');
grant all privileges on *.* to 'lportal'@'localhost' identified by 'lportal'

With MySql 5.1.35, at least, this doesn't quite work, because user 'lportal' is created with an associated host of '%', but by creating user 'lportal'@'localhost' the password and privileges can be set.

This assumes that I have

jdbc.default.username=lportal
jdbc.default.password=lportal

in portal-ext.properties.

Shouldn't these wrinkles be mentioned in this article as well?

Posted on 7/30/09 9:17 PM.

Top Top
Someone really needs to clean this documentation up, I am trying to attempt this with 5.2.3 and am confused, need to seperate 4.x and 5.1.x old configs, and group them under a seperate wiki/doc location.

Posted on 8/12/09 12:26 PM.

Top Top
I have a similar issue.
I just want to move data from a portal working with hsql, to another portal working with mysql
The only thing that i have to recover are users.
So I extracted the user INSERT INTO lines from lportal.script, and created a script that worked perfectly in mysql

When I run : select * from User_ I see the records that I have added
but in the portal, I still only see the old users?

(I restarted everything : liferay and mysql)

Posted on 9/29/09 6:43 AM.

Top Top
Can someone plz help me connecting to a SQl database. . . . i have been strugeling for 2 days. i am new to liferay .i am running 5.2.3

Posted on 12/14/09 1:31 AM.

Top Top
Hi,
I was able to configure Liferay Portal Standard Edition 5.2.3 with MySQL. I have used JNDI configuration. Steps as follows -

Tasks 1 - ROOT Webapp

Unzip portal-impl.jar inside LIFERAY_HOME/webapps/ROOT/WEB-INF/lib
Search for file portal.properties and extract it to the folder - LIFERAY_HOME/webapps/ROOT/WEB-INF/classes
Rename the extracted file to portal-ext.properties
Comment out the following lines in the file -
# include-and-override=portal-ext.properties
#include-and-override=${liferay.home}/portal-ext.properties
I am not sure if commenting the above lines is needed. But i did commented it.

Search for jdbc.default.jndi.name=jdbc/LiferayPool in the file.
Uncomment the above line in the file. So now you will be using JNDI lookup for the database.

Open the file ROOT.xml inside the folder LIFERAY_HOME/conf/Catalina/localhost
Copy the following line -
<ResourceLink global="jdbc/LiferayPool" name="jdbc/LiferayPool" type="javax.sql.DataSource"/>

Tasks 2 - wol-portlet

Go to folder LIFERAY_HOME/webapps/wol-portlet/WEB-INF/classes/META-INF
Open the file - ext-spring.xml
Comment out the following lines -
<!-- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/jdbc.properties</value>
</property>
<property name="placeholderPrefix" value="${jdbc." />
</bean> -->
<!-- <bean id="jiraDataSourceTarget" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.jira.driverClassName}" />
<property name="url" value="${jdbc.jira.url}" />
<property name="username" value="${jdbc.jira.username}" />
<property name="password" value="${jdbc.jira.password}" />
</bean> -->

Uncomment the following line -

<bean id="jiraDataSourceTarget" class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName">
<value>jdbc/JIRAPool</value>
</property>
</bean>

Go to folder LIFERAY_HOME/webapps/wol-portlet/META-INF
Open the file - context.xml
Add the following line -
<ResourceLink global="jdbc/JIRAPool" name="jdbc/JIRAPool" type="javax.sql.DataSource"/>

Copy the context.xml to folder LIFERAY_HOME/conf/Catalina/localhost
Rename it as wol-portlet.xml

Tasks 3 - Creating Database and users

Create the following 2 database and users as follows -

Start MySQL
Run the following scrips from MySQL Prompt -

create database lportal character set utf8;
grant usage on lportal.* to luser@localhost identified by 'lpass';
grant all privileges on lportal.* to luser@localhost;

grant usage on lportal.* to 'luser'@'%' identified by 'lpass';
grant all privileges on lportal.* to 'luser'@'%';

create database jira character set utf8;
grant usage on jira.* to ljuser@localhost identified by 'ljpass';
grant all privileges on jira.* to ljuser@localhost;

grant usage on jira.* to 'ljuser'@'%' identified by 'ljpass';
grant all privileges on jira.* to 'ljuser'@'%';

Now you have 2 database created. lportal for ROOT. and jira for wol-portlet.

Tasks 4 -

Creating Resource in server.xml
Open the server.xml file under LIFERAY_HOME/conf
Add the following resource under <GlobalNamingResources>
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="50" maxIdle="10" maxWait="10000"
removeAbandoned="true" removeAbandonedTimeout="240" validationQuery="SELECT 1" name="jdbc/LiferayPool" password="lpass" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/lportal" username="luser" />

<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" maxActive="50" maxIdle="10" maxWait="10000"
removeAbandoned="true" removeAbandonedTimeout="240" validationQuery="SELECT 1" name="jdbc/JIRAPool" password="ljpass" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/jira" username="ljuser" />

Assumption - the mysql jdbc jar is in ext/lib folder.

Now you are good to start the server and your Liferay with MySQL should be working well and fine.

All the Best

Prem Kashyap

Posted on 12/14/09 4:19 AM in reply to CJ van Tonder.

Top Top
Just found out. Actually you do not need the jira database created. As I verify now, all the wol-portlet related tables got created inside the lportal database. So we do not need to creatre the jira database and we can point our JNDI jdbc/JIRAPool to lportal database.

Regards
Prem Kashyap

Posted on 12/14/09 4:31 AM in reply to Prem Kashyap.

Top Top
Thank you so much, really helpfull infos.
But, just wondering, if we want to install JIRA in our environment, should we use this jira database settings or will we need to point new database settings?

Posted on 1/6/10 12:07 AM in reply to Prem Kashyap.

Top Top
Awesome - managed to get it working.

Just one question: How do I check/confirm that Liferay Portal is actually using MySQL? I saw some messages on startup. Can I check in the Control Panel under the properties section?

Posted on 1/7/10 10:46 AM in reply to andrew chen.

Top Top