Liferay Portal v5, Glassfish v3, and Oracle

There are a lot of guides for how to install Liferay Portal (1 2 3 4), but sadly, none of them work as advertised for installing Liferay Portal 5.2.3 on an existing Glassfish v3 Prelude application server, using an Oracle database, and configured as a Windows service. After much trial and error, I've come up with the following guide that may help others along the way:

Liferay Portal on Windows

Warning: If the Oracle driver .jar files are not designed for your JDK version, use the latest Oracle drivers that are designed for your JDK version (i.e. if you're using Oracle 10g with JDK 1.6, the ojdbc14.jar 10g driver doesn't support JDK 1.6, therefore use the 11g ojdbc6.jar driver, etc.) I found this when the "Control Panel > Portal > Settings" link displayed random binary data in my web browser and I received a com.liferay.portal.kernel.dao.orm.ORMException error in the log file.

Update: The Oracle database connection kept dropping overnight so in the GlassFish JDBC settings screen for the "LiferayPool" connection pool, I located the "Connection Validation" section and placed a check in the "Connection Validation - Required" and "On Any Failure - Close All Connections" checkboxes.

Update: After reading Sun's GlassFish optimization white paper, I've made the following updates to my configuration:

====================================================

In addition to user, password, and URL (mentioned in the PDF guide), you should also add the following to your JDBC additional properties:

Name=MaxStatements, Value=200
Name=ImplicitCachingEnabled, Value=true

====================================================

domain.xml (in {gf domain}\config folder) updated with the following:

Changed:
old: <jvm-options>-client</jvm-options>
new: <jvm-options>-server</jvm-options>

old: <http-listener id="http-listener-1" port="8080" address="0.0.0.0" default-virtual-server="server" server-name="" />
new: <http-listener id="http-listener-1" port="8080" address="0.0.0.0" default-virtual-server="server" server-name="" acceptor-threads="#" />   (where "#" refers to the number of cores on your machine or VM, e.g. "2" for a dual-core processor)

Added:
<jvm-options>-XX:+UseLargePages</jvm-options>
<jvm-options>-XX:LargePageSizeInBytes=#m</jvm-options>   (where "#" is 4 for Windows Server 2003+ 32-bit installations, 16 for Windows Server 2003+ 64-bit installations, and 256 for Solaris or Linux 64-bit installations) (note: if you get "object heap" log errors, you may need to reduce these values by half)

====================================================

default-web.xml (in {gf domain}\config folder) updated with the following:

old:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>

new:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>development</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>genStrAsCharArray</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>

====================================================

Comments

Popular Posts