Chapter 2. Installation

Thomas Heute

2.1. Install Overview

There are a couple of archives that you will need to download in order to install JBoss Portal.

2.1.1. JBoss Application Server

Of course you will need to install JBoss Application Server prior to install JBoss portal, if you didn't do so yet, please install JBoss 4.0.2 from Sourceforge.

2.1.2. Getting the JBoss Portal files

You can download JBoss portal in different ways, packaged in binaries, sources or from the CVS.

  • Packaged: From the JBoss portal project page
  • CVS Version 2.0 RC2: cvs -d :pserver:anonymous@anoncvs.forge.jboss.com:/cvsroot/jboss co -r JBoss_Portal_2_0_0 jboss-portal-2.0
  • CVS Version HEAD (The most up to date sources at your own risks): cvs -d :pserver:anonymous@anoncvs.forge.jboss.com co jboss-portal-2.0

Warning

Do not attempt to get the jboss-portal module. The latest release is jboss-portal-2.0

2.1.3. Database

You will need a database to store the data of the system, you can use any database supported by Hibernate. We have tested JBoss Portal on the following, but other should work just the same:

  • MySQLDB

  • Hypersonic DB

  • PostGreSQL

  • Oracle 10g

2.1.4. JDBC connector

You must make sure that your JDBC connector for your database is under server/default/lib. The MySQL JDBC connector is available here, the postgreSQL JDBC connector is available here.

2.2. Setting up your environment

2.2.1. Database

All databases supported by hibernate are support by JBoss Portal. Below is a generic ordered list of steps that should be followed on any DB:

  1. Create a new Database. For MySQL we name it jbossportal.

  2. Give access rights to whatever user with whatever password to this new database. For MySQL we create a user "portal" and give him a password "portalpassword", and grant him rights to the jbossportal DB.

Note

As of JBoss Portal RC2, all database tables will be created for you at runtime. The only thing you need to make certain is that there is a database created, a working JDBC connector, and that the user/password combination works.

2.2.2. JBoss AS Configuration

If you need a custom setup of JBoss AS, you should read the documentation about JBoss application server. In our case, we will use the default configuration shipped with JBoss AS 4.0.2.

At this stage you should have the jboss-4.0.2.zip or any other archive of the same version. First you need to setup JBOSS_HOME environment variable otherwise you won't be able to compile JBoss Portal. To do so go to Start > Settings > Control Panel > System > Advanced > Environment Variables, and add the JBOSS_HOME environment variable. Or do export JBOSS_HOME=/path/to/your/jboss/directory on a Unix-like system.

2.3. Deploying JBoss Portal

2.3.1. From the binaries

The downloaded archive contains the following files:

  • jboss-portal.sar
  • portal-forums.ear
  • /setup/portal-*-ds.xml

Note

It is important that you configure the correct datasource file under /setup. There are a few already created for support of popular databases. You can also create your own. Please verify that the username, password, url, and driver-class are correct for your flavor of DB. You can deploy the datsource file by itself to test, in advance.

  1. Copy/Move jboss-portal.sar, portal-forums.ear, and your configured portal datasource file to $JBOSS_HOME/server/default/deploy

2.3.2. From the sources

  1. First, build the sources and deploy them, go to jboss-portal-2.0/build and type sh build.sh deploy, you should read BUILD SUCCESSFUL at the end of the operation. This operation should have copired the jboss-portal.sar to your $JBOSS_HOME/server/default/deploy directory.

    Warning

    Make sure that JBOSS_HOME is still defined in the environment or it will not work.

  2. Now you will need to build the datasource files for DB access. To do so go to jboss-portal-2.0/core and type sh build.sh datasource. It will create all the files under jboss-portal-2.0\core\output\resources\setup.

    Note

    It is important that you configure the correct datasource file jboss-portal-2.0\core\output\resources\setup. There are a few already created for support of popular databases. You can also create your own. Please verify that the username, password, url, and driver-class are correct for your flavor of DB. You can deploy the datsource file by itself to test, in advance.

  3. Before you deploy the application by itself, you will need to have the database deployment descriptor (portal-*-ds.xml) in the $JBOSS_HOME\server\default\deploy directory. To do so copy the correct portal-*-ds.xml file in to the /deploy directory.

  4. You will also need to put the jar file of your database connector in $JBOSS_HOME\server\default\lib, if you have not already done so.

2.4. Running JBoss Portal

Now you can start JBoss AS by going into $JBOSS_HOME/bin and typing run. All database tables, cms directories, and initial content for each will be created/inserted during the startup process, if it does not exist.

Warning

If the forums portlet is not installed, the link to the forums page will not work, see the forums portlet chapter of this document for the installation instructions.

Using your browser, navigate to http://localhost:8080/portal and you should see the portal.

2.5. Customizing your installation

2.5.1. Changing the port

It is common to have a server running on the port 80 instead of the default port 8080, to change that you will need to change it at two levels:

  • To change it at the server level, you need to edit the file $JBOSS_HOME/server/default/deploy/jbossweb-tomcat50.sar/server.xml and change the port value of the HTTP Connector to the same value as you defined in the portal.

  • Next, you will need to modify the web.xml descriptor in the CMSPortlet for it to be able to find the webDAV server. You can find more information about how to do this here.

Note

You can also change in those same files, the value of the SSL port, by default it is set to 8443

Now you can restart JBoss and use the new port that you defined. On systems like Linux, you need privileges to be able to run a server on a port lower than 1000, starting JBoss on the port 80 as a regular user will not work, for testing you can log as root but is not recommended if the server is public as it could be a security breach in your system.

2.5.2. Changing the context path

By default, the "main" page of JBoss portal will be accessible at http://localhost:8080/portal/index.html. You may want to change that either to a different name or to http://localhost:8080/index.html.

Note

To do so, edit the file $PORTAL_HOME/build/local.properties and change portal.context-root to anything you want.

Now you can rebuild JBoss portal and redeploy it tfor the context path changes to take effect.

2.5.3. Rebuilding the DB tables

If you would like to re-create the initial database tables, ie. start with a blank install, you can do it by following these steps:

  1. Log in to the JMX-Console: http://localhost:8080/jmx-console/

  2. Locate the portal hibernate mbean. From this screen, you can execute operations.

  3. To drop the database tables and recreate them, first execute destroySchema(). Then execute, createSchema(). Finally execute createContent().

The database should now be restored to how it was on initial install and deployment.

2.5.4. Forcing the DB dialect

If you encounter that the Hibernate dialect is not working properly and would like to override the default behaviour, you simply need to modify jboss-portal.sar/conf/hibernate/hibernate.cfg.xml. A list of supported dialects for Hibernate3, can be found here.

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory
      name="java:portal/SessionFactory">
      <property name="connection.datasource">java:@portal.datasource.name@</property>
      <property name="show_sql">false</property>

      <!-- Force the dialect instead of using autodetection -->
      <!--
      <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
      -->

      <!-- Mapping files -->
      <mapping resource="org/jboss/portal/core/impl/role/RoleImpl.hbm.xml"/>
      <mapping resource="org/jboss/portal/core/impl/user/UserImpl.hbm.xml"/>
      <mapping resource="org/jboss/portal/core/impl/user/UserPref.hbm.xml"/>
      <mapping resource="org/jboss/portal/core/impl/user/UserPrefSet.hbm.xml"/>
   </session-factory>
</hibernate-configuration>