Foros de discusión

Howto make Liferay 5.2.3 work with Geronimo 2.1.4

thumbnail
Malte Cornils, modificado hace 14 años.

Howto make Liferay 5.2.3 work with Geronimo 2.1.4

New Member Mensajes: 13 Fecha de incorporación: 15/06/09 Mensajes recientes
This is a HOWTO I've written after some help from others here and trying around. Use it as you see fit.

How to install Geronimo and Liferay (with working installation of self-created portlets)

Create the target directory, we assume D:\web from now on. This Guide assumes Windows due
to legacy reasons on our side, although I can only recommend Linux servers for any
new deployments :-)

1. Java

Java 5 or 6 should be installed. We assume Java SE 1.6 SDK here, which has been installed
in C:\Java.

2. Geronimo

At first, download Geronimo 2.1.4 and unpack into D:\web\geronimo. Now, the directory tree
should look like this:

D:\web\geronimo\bin
cluster-repository
[...]


Finally, the Java environment for Geronimo has to be correctly configured.
Liferay needs quite a lot of memory, so the file

D:\web\geronimo\bin\geronimo.bat

has to be adapted, e.g. by adding above the first line:

SET JAVA_HOME=C:\Java
SET JAVA_OPTS=-Xms512m -Xmx1824m -XX:MaxPermSize=512m

[Note: Using a setenv file would also be possible, as well as setting the
parameters system-wide]

Now, on the command line, change to the directory
d:\web\geronimo\bin and start the server for testing
purposes with "geronimo run". Without further configuration,
it should now be reachable under http://localhost:8080/.

From there, you should check whether the admin console is reachable,
under http://localhost:8080/console/ with the account name "system"
and the password "manager". Then, under "Web app WARs", the
module welcome-tomcat should be located, which squats on the "/"
context. After a click on "expert user", it can and should be stopped.
If you want to deploy liferay portal in a different context, this
step is not necessary. The console should still be reachable under
console/.

With Ctrl-C on the command line, Geronimo should be stopped now (say
yes to "Terminate batch job"); alternatively, you can shut down
via the admin console.

3. Liferay Dependencies

At first, download the Liferay base libraries (Downloads/Additional Files/Liferay
Portal 5.2.3 Dependencies) and extract them into the subdirectory
D:\web\geronimo\var\shared\lib .

Now, this directory contains the files hsql.jar, annotations.jar etc.

Both the file portal-kernel.jar and portal-service.jar should be kept additionally
on your desktop PC, we will need them later again.

Then, download from
http://jdbc.postgresql.org/download.html#current

a current PostgreSQL driver (for Java 1.6, choose the JDBC4 variant). This should also
be moved into the directory
D:\web\geronimo\var\shared\lib .

Now, start the server again ("geronimo run").

In the admin console, you have to create a database pool now.
The name must be jdbc/LiferayPool. As a database, choose Derby embedded.
On the following page, select the one listed jar and choose deploy.
This creates a pool; however, it is not yet configured well in Liferay.
We will not actually is the pool now, however (that is for a possible
later edition of this howto).

4. Liferay

Now, download Liferay to your desktop PC
(Downloads/Additional Files/Liferay Portal 5.2.3 WAR).

Unfortunately, we have to modify this WAR file to change the liferay home directory.
It is by default in Geronimo's bin directory and can be changed only by overriding
stuff in the WAR file.
Extract the War file (it is actually a renamed ZIP). In the folder WEB-INF/classes, a file
called portal-ext.properties must be created that contains the following entries (some
are a little redundant):

portal.ctx=/
liferay.home=d:/web
resource.repositories.root=d:/web
default.liferay.home=../..
auto.deploy.geronimo-tomcat.dest.dir=d:/web/geronimo/deploy
auto.deploy.geronimo.dest.dir=d:/web/geronimo/deploy
jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://opensc-p.charite.de/portaldb
jdbc.default.username=portal
jdbc.default.password=lichtlos1
locale.default.request=true
locales=de_DE,en_US,es_ES,pt_PT,pl_PL

If the PostgreSQL database is not yet available,
you can leave out the JDBC lines. Then, the built-in hypersonic database is used.
You could also try to follow Liferay's documentation to configure the database
pool set up above.

The above-mentioned files portal-kernel.jar and portal-service.jar need to be
copied to the directory WEB-INF/lib. This fixes the following Liferay problem:
http://issues.liferay.com/browse/LPS-3518

Then, the Liferay WAR file has to be archived again. Use a ZIP compressor like
7zip. The resulting file can be renamed into WAR. It is crucial that the folders
dtd, errors etc. are on the top level of the ZIP/WAR file.

In the admin console, you should now choose "Deploy New".
As a WAR file, choose the downloaded and modified WAR file.

The deployment plan needs some work. We open the downloaded WAR file read-only again
and copy out the WEB-INF/geronimo-web.xml file. We edit that and look for the
lines around the artifactId liferay-pool. We change them to the following ones:


<dependency>
<groupId>console.dbpool</groupId>
<artifactId>jdbc_LiferayPool</artifactId>
</dependency>

Also, remove the entry <inverted-classloading />

Also, add the following lines to the filters:

<filter>org.apache.xerces</filter>
<filter>org.hibernate</filter>
<filter>log4j</filter>

This file should now be taken as the deployment plan. "Start app after install"
can be activated. Liferay should now start up and be displayed under
"Applications/Web App WARS". This is something that never worked for me
in the bundle, by the way.

With http://localhost:8080/, Liferay should now be reachable. As an account name,
"test@liferay.com" should be used, the password is "test".

5. Configuration

Self-created portlets can now be deployed and should work. The setting up of the
Liferay portlet SDK is not explained here, though.

Good luck!
thumbnail
Malte Cornils, modificado hace 14 años.

RE: Howto make Liferay 5.2.3 work with Geronimo 2.1.4

New Member Mensajes: 13 Fecha de incorporación: 15/06/09 Mensajes recientes
Actually, these instructions are wrong - custom portlets can then no longer be developed. The com.liferay hidden classes filter
must *not* be there. I have now edited my post and deleted this line.
thumbnail
Albert J Carter-Corbin, modificado hace 14 años.

RE: Howto make Liferay 5.2.3 work with Geronimo 2.1.4

Regular Member Mensajes: 123 Fecha de incorporación: 12/09/06 Mensajes recientes
The hidden fields is one of the reaons why I put the liferay jar files in the var/shared/lib directory and replaced the default geronimo-web.xml file. This way every portlet had access to the liferay libraries.
Thomas Fröhlich, modificado hace 14 años.

RE: Howto make Liferay 5.2.3 work with Geronimo 2.1.4

New Member Mensajes: 21 Fecha de incorporación: 2/09/09 Mensajes recientes
Hi Malte,

The com.liferay hidden classes filter must *not* be there.


What do you mean?

<hidden-classes>
<filter>javax.xml.bind</filter>
<filter>org.apache.xerces</filter>
<filter>org.hibernate</filter>
<filter>log4j</filter>
</hidden-classes>

The filter fields must be surrounded by a <hidden-classes> tag or not?

Kind regards

Thomas
Thomas Fröhlich, modificado hace 14 años.

RE: Howto make Liferay 5.2.3 work with Geronimo 2.1.4

New Member Mensajes: 21 Fecha de incorporación: 2/09/09 Mensajes recientes
Nice HowTo, Malte,

but it didn't work here. My test environment:

- Windows XP 32, JDK 1.6

- installed the geronimo package geronimo-tomcat6-javaee5-2.1.4-bin.zip in c:\geronimoserver\geronimo
the directory tree should look like this: c:\geronimoserver\geronimo\bin

- c:\geronimoserver\geronimo\bin\setenv.bat contains:
set GERONIMO_HOME=C:\geronimoserver\geronimo
set JAVA_HOME=C:\Programme\Java\jdk1.6.0_12
set JAVA_OPTS=-XX:MaxPermSize=256m -Xms512m -Xmx1024m -Dfile.encoding=UTF-8 -Duser.timezone=GMT

- created dir c:\geronimoserver\liferay

- my portal-ext.properies in In the folder WEB-INF/classes in the used archive liferay-portal-5.2.3.war looks like this;

portal.ctx=/
liferay.home=C:/geronimoserver/liferay
resource.repositories.root=C:/geronimoserver/liferay
default.liferay.home=../../liferay
auto.deploy.geronimo-tomcat.dest.dir=C:/geronimoserver/geronimo/deploy
auto.deploy.geronimo.dest.dir=C:/geronimoserver/geronimo/deploy
locale.default.request=true
locales=de_DE,en_US,es_ES,pt_PT,pl_PL

#jdbc.default.driverClassName=oracle.jdbc.driver.OracleDriver
#jdbc.default.url=jdbc:oracle:thin:@192.168.20.231:1521emoticonCL
#jdbc.default.username=LIFERAY
#jdbc.default.password=xxxxxxx
#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
#hibernate.jdbc.batch_size=0
#hibernate.show_sql=true
#custom.sql.vendor.oracle=true

theme.shortcut.icon=favicon.ico

- portal-kernel.jar and portal-service.jar are in the war file as described

- used this deployment plan:

<?xml version="1.0"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
<environment>
<moduleId>
<groupId>liferay</groupId>
<artifactId>liferay-portal-tomcat</artifactId>
<version>5.2.0</version>
<type>car</type>
</moduleId>
<dependencies>
<dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>j2ee-server</artifactId>
<type>car</type>
</dependency>
<dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>sharedlib</artifactId>
<type>car</type>
</dependency>
<dependency>
<groupId>org.apache.geronimo.framework</groupId>
<artifactId>j2ee-security</artifactId>
<type>car</type>
</dependency>
<dependency>
<groupId>org.apache.geronimo.framework</groupId>
<artifactId>rmi-naming</artifactId>
<type>car</type>
</dependency>
<dependency>
<groupId>console.dbpool</groupId>
<artifactId>jdbc_LiferayPool</artifactId>
</dependency>
<!--<dependency>
<groupId>liferay</groupId>
<artifactId>portal-kernel</artifactId>
<type>jar</type>
<import>classes</import>
</dependency>
<dependency>
<groupId>liferay</groupId>
<artifactId>portal-service</artifactId>
<type>jar</type>
<import>classes</import>
</dependency>
<dependency>
<groupId>portlet-api</groupId>
<artifactId>portlet-api</artifactId>
<type>jar</type>
<import>classes</import>
</dependency>-->
</dependencies>
<hidden-classes>
<filter>javax.xml.bind</filter>
<filter>org.apache.xerces</filter>
<filter>org.hibernate</filter>
<filter>log4j</filter>
</hidden-classes>
<inverse-classloading />
</environment>
<context-root>/</context-root>
<security-realm-name>PortalRealm</security-realm-name>
<security>
<default-principal>
<principal name="anonymous" class="com.liferay.portal.kernel.security.jaas.PortalPrincipal" />
</default-principal>
<role-mappings>
<role role-name="users">
<principal class="com.liferay.portal.kernel.security.jaas.PortalRole" name="users" />
</role>
</role-mappings>
</security>
<gbean name="PortalRealm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
<attribute name="realmName">PortalRealm</attribute>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
<!--<reference name="LoginService">
<name>JaasLoginService</name>
</reference>-->
<xml-reference name="LoginModuleConfiguration">
<log:login-config xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0">
<log:login-module control-flag="REQUIRED" wrap-principals="false">
<log:login-domain-name>PortalRealm</log:login-domain-name>
<log:login-module-class>com.liferay.portal.security.jaas.ext.tomcat.PortalLoginModule</log:login-module-class>
</log:login-module>
</log:login-config>
</xml-reference>
</gbean>
</web-app>

The deployment of the war in Geronimo was successful. But if I want to start the Liferay app in the Geronimo console -> "Web App WARs" -> start many exceptions are thrown as:

In the menu item "Web App WARs":

Error rendering portlet.

java.lang.ClassCastException: org.apache.geronimo.management.StatisticsProvider$$EnhancerByCGLIB$$9e182224$$FastClassByCGLIB$$7942419c cannot be cast to net.sf.cglib.reflect.FastClass
at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:64)
at net.sf.cglib.reflect.FastClass.create(FastClass.java:46)
at net.sf.cglib.reflect.FastClass.create(FastClass.java:39)
at org.apache.geronimo.kernel.basic.BasicProxyManager$ManagedProxyFactory.(BasicProxyManager.java:203)
at org.apache.geronimo.kernel.basic.BasicProxyManager.createProxyFactory(BasicProxyManager.java:78)
at org.apache.geronimo.kernel.basic.BasicProxyManager.createProxy(BasicProxyManager.java:116)
at org.apache.geronimo.console.util.KernelManagementHelper.getModuleForConfiguration(KernelManagementHelper.java:524)
at org.apache.geronimo.console.util.PortletManager.getModule(PortletManager.java:368)
................

In the file geronimo.log:

2009-09-10 13:20:30,998 ERROR [[/]] StandardWrapper.Throwable
java.lang.ExceptionInInitializerError
at org.apache.axis.description.TypeDesc.<clinit>(TypeDesc.java:61)
at oasis.names.tc.wsrp.v1.types.StateChange.<clinit>(StateChange.java:59)
at com.liferay.portlet.wsrp.ConsumerEnvironmentImpl.<init>(ConsumerEnvironmentImpl.java:69)
at com.liferay.portlet.wsrp.WSRPProxyPortlet.<clinit>(WSRPProxyPortlet.java:785)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.liferay.portlet.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:229)
at com.liferay.portlet.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:217)
at com.liferay.portlet.PortletInstanceFactoryImpl.create(PortletInstanceFactoryImpl.java:140)
at com.liferay.portlet.PortletInstanceFactoryUtil.create(PortletInstanceFactoryUtil.java:47)
at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:231)
at javax.servlet.GenericServlet.init(GenericServlet.java:215)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1064)
....................

Caused by: org.apache.commons.discovery.DiscoveryException: Class org.apache.geronimo.kernel.log.GeronimoLogFactory does not implement org.apache.commons.logging.LogFactory
at org.apache.commons.discovery.tools.ClassUtils.verifyAncestory(ClassUtils.java:135)
at org.apache.commons.discovery.tools.SPInterface.verifyAncestory(SPInterface.java:156)
at org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:150)
........................

2009-09-10 13:20:31,092 ERROR [[/]] Servlet / threw load() exception
org.apache.commons.discovery.DiscoveryException: Class org.apache.geronimo.kernel.log.GeronimoLogFactory does not implement org.apache.commons.logging.LogFactory
at org.apache.commons.discovery.tools.ClassUtils.verifyAncestory(ClassUtils.java:135)
at org.apache.commons.discovery.tools.SPInterface.verifyAncestory(SPInterface.java:156)
at org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:150)
at org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:534)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:373)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:333)
at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
...........................

And Liferay doesn't work of course emoticon At http://localhost:8080/ I got

java.lang.ArrayIndexOutOfBoundsException: 0
at com.liferay.portal.util.PortalInstances._getDefaultCompanyId(PortalInstances.java:232)
at com.liferay.portal.util.PortalInstances._getCompanyId(PortalInstances.java:189)
at com.liferay.portal.util.PortalInstances.getCompanyId(PortalInstances.java:71)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
at com.liferay.portal.servlet.filters.threadlocalcache.ThreadLocalCacheFilter.processFilter(ThreadLocalCacheFilter.java:55)
..................................

I did everything explained in this thread. Where I'm wrong? Any suggestions?
Ty for every helpful information.

Thomas