This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. JPA on GlassFish
Introduction #
This document provides the configuration details to setup the JPA when running on GlassFish V2. It is assumed that the Liferay is already installed on GlassFish V2 server.
Summary #
The Configuration includes two parts
- Instrumentable Class Loader for GlassFish
- Configuring JPA with Spring's GlassFish Load Time Weaver
Stop Server #
Stop the GlassFish server if it is running.
Instrumentable Class Loader for GlassFish #
The GlassFish server has support for Instrumentable Class Loader and it works only for EAR Environment. As Liferay is a web application the GlassFish must be configured with a Class Loader that is capable of Instrumentation required by Spring.
Configure context.xml and copy into META-INF directory of the deployed web application directory. For example, /opt/glassfish/domains/domain1/applications/j2ee-modules/liferay-portal/META-INF
<Context path="/" ><Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader" useSystemClassLoaderAsParent="false"/> </Context> }}}
Configure portal-ext.properties #
Configure portal-ext.properties with following parameters. Essentially, the following configuration enables JPA as persistence provider and informs JPA to use GlassFish related Load Time Weaver.
persistence.provider=jpatransaction.isolation.portal=-1 jpa.load.time.weaver=org.springframework.instrument.classloading.glassfish.GlassFishLoadTimeWeaver}}}
Copy the “spring-instrument-tomcat.jar” #
Copy the “spring-instrument-tomcat.jar” file into GlassFish's server lib. Assuming that the GlassFish is installed under /opt/glassfish, copy the file into /opt/glassfish/lib. The file can be found in the "lib/development" directory of Liferay source tree.
Start the Server #
Start the GlassFish Server.
NOTE: Please use the jdbc configuration as usual for your choice of database
Reference: http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/JPA+integration