« Indietro

Liferay 6.1 on Jboss 5.1.0

Staff Blogs 6 luglio 2012 Da Ricardo Funke Ormieres Staff

In order to proceed please download the following from your Customer Portal.

  • Liferay Portal 6.1 EE WAR
  • Liferay Portal 6.1 EE Dependencies

Preparing Jboss for Liferay

  • First, create a directory that will be the Liferay's home. We will call it $LIFERAY_HOME.
  • Download Jboss and extract it into de $LIFERAY_HOME. Jboss directory will be referred as $JBOSS_HOME.
  • In $JBOSS_HOME/bin/run.conf (or run.conf.bat for Windows) change the JAVA_OPTS variable to have the following options:
    • Change -Xmx512m to -Xmx1024m 
    • Add -Dfile.encoding=UTF-8 -Duser.timezone=GMT -Djava.net.preferIPv6Addresses=false -Djava.net.preferIPv4Stack=true
  • Open $JBOSS_HOME/server/default/conf/standardjbosscmp-jdbc.xml and search for the "Hypersonic SQL" type-mappping in the file. Change:

<type-mapping>

         <name>Hypersonic SQL</name>
         <row-locking-template/>
         ...
         <mapping>
            <java-type>java.lang.Object</java-type>
            <!-- hsqldb only supports directly serializable objects for sql type OBJECT -->
            <jdbc-type>VARBINARY</jdbc-type>
            <sql-type>VARBINARY</sql-type>
         </mapping>
         ...
      </type-mapping>
  • to
<type-mapping>
         <name>Hypersonic SQL</name>
         <row-locking-template/>
         ...
         <mapping>
            <java-type>java.lang.Object</java-type>
            <!-- hsqldb only supports directly serializable objects for sql type OBJECT -->
            <jdbc-type>VARBINARY</jdbc-type>
            <sql-type>VARBINARY(1024)</sql-type>
         </mapping>
          ...
      </type-mapping>
  • Remove hibernate-validator.jar from $JBOSS_HOME/common/lib/.
  • Edit $JBOSS_HOME/server/default/conf/login-config.xml and comment out the entire XML for policy "other" in lines 113-129. For example:
  <!--application-policy name="other"-->
  ...
    <!--authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required"/>
    </authentication>
  </application-policy-->

 

Database Configuration

  • Download the jdbc connector for your database and copy it into $JBOSS_HOME/server/default/lib/. We will use MySQL for this tutorial.
  • If you want Jboss to manage the data source, create the file $JBOSS_HOME/server/default/deploy/liferay-ds.xml with the following content:
<datasources>
<local-tx-datasource>
  <jndi-name>jdbc/LiferayPool</jndi-name>
  <connection-url>jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8</connection-url>
  <driver-class>com.mysql.jdbc.Driver</driver-class>
  <user-name>root</user-name>
  <password>root</password>
  <min-pool-size>0</min-pool-size>
</local-tx-datasource>
</datasources>
  • Then create a file called portal-ext.properties in $LIFERAY_HOME and add the following line:

jdbc.default.jndi.name=jdbc/LiferayPool

  • If you wish to manage configuration through Liferay, you will add the following directives instead of adding the line above in 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=root
  • Don't forget to change the informations to correspond to your database settings.
  • Also, you may want to use the Liferay's startup wizard to set the database. In this case, don't do any of the configurations above, just install your jdbc driver, finish this tutorial and start Liferay. Then access http://localhost:8080 and set the database configurations. This way, Liferay will create a file called portal-setup-wizard.properties in $LIFERAY_HOME with your database settings.

Mail Configuration

  • If you want Jboss to manage the mail configuration, set mail properties by replacing the contents of $JBOSS_HOME/server/default/deploy/mail-service.xml with:
<?xml version="1.0"?>
<server>
  <mbean code="org.jboss.mail.MailService" name="jboss:service=MailSession">
    <attribut name="JNDIName">mail/MailSession</attribute>
    <attribute name="User">nobody</attribute>
    <attribute name="Password">password</attribute>
    <attribute name="Configuration">
      <configuration>
        <property name="mail.store.protocol" value="imap"/>
        <property name="mail.transport.protocol" value="smtp"/>
        <property name="mail.imap.host" value="localhost"/>
        <property name="mail.pop3.host" value="localhost"/>
        <property name="mail.smtp.host" value="localhost"/>
      </configuration>
    </attribute>
  </mbean>
</server>
  • Then, add the following line to the portal-ext.properties file:

mail.session.jndi.name=mail/MailSession

  • Again, if you want to use portal-ext.properties instead, set the following properties in this file:
mail.session.mail.pop3.host=localhost
mail.session.mail.pop3.password=
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.smtp.auth=false
mail.session.mail.smtp.host=localhost
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=25
mail.session.mail.smtp.user=
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp
  • Don't forget to change the settings according to your mail server.
  • Also, you may want to set this in the Liferay database, so instead of doing the settings above, make the Deploy Liferay section below, go to "Control Panel" -> "Server Administration" -> "Mail" and fill in the fields.

Deploy Liferay

  • Unzip the Liferay Portal 6.1 EE Dependencies file and copy the contents (the .jar files) to $JBOSS_HOME/server/default/lib/
  • Delete all the files and folders in $JBOSS_HOME/server/default/deploy/ROOT.war
  • Unzip the Liferay Portal 6.1 EE WAR file to the ROOT.war directory.
  • Remove jaxrpc.jar, stax.jar, xercesImpl.jar, xml-apis.jar from $JBOSS_HOME/server/default/deploy/ROOT.war/WEB-INF/lib/

Start Jboss

  • Go to $JBOSS_HOME/bin and type ./run.sh for Linux or run.bat for Windows
  • Open your browser and access http://localhost:8080
Commenti Autore Data
Thank you Ricardo, your receipt worked for me... Péter Borkuti 23 luglio 2012 22.09
[...] Hola comunidad! Estoy metiéndome en el... Anonimo 1 settembre 2012 22.14
[...] Hi Hitoshi! Firstly my apologies for... Anonimo 5 settembre 2012 5.38
Thank you. Simple and clear. As i tried it on a... Michele Zanarotti 5 marzo 2013 9.17

Thank you Ricardo, your receipt worked for me without any problem.
(I tried with HSQL and without mail-setup)

I need to deploy liferay many times, so this little script was handy for me:
-------------------del-jars-from-webinf.bat----------------------
set PORTAL=portal

cd %PORTAL%\jboss-5.1.0.GA\server\default\deploy\ROOT.war\WEB-INF\lib

del jaxrpc.jar stax.jar xercesImpl.jar xml-apis.jar
----------------------------------------------------------
Inviato il 23/07/12 22.09.
[...] Hola comunidad! Estoy metiéndome en el mundo LF 6.1 hace ya una semana aprox. y estoy levantándolo en JBOSS 5.1.0 con un WAR (en Windows 7) esto me ha funcionado la primera vez siguiendo el siguiente... [...] Read More
Inviato il 01/09/12 22.14.
[...] Hi Hitoshi! Firstly my apologies for write this in that line: (Used, liferay-portal-6.1.1-ce-GA2-20120731132656558.war and liferay-portal-1.6.20-ee-GA2-20120731110418084.war) because in that line I... [...] Read More
Inviato il 05/09/12 5.38.
Thank you. Simple and clear.
As i tried it on a CE version, I can say that there's no difference in the procedure, except for the dependencies and war package. It runs smoothly and apparently without any glitch.
Inviato il 05/03/13 9.17.