Running Roller Weblogger on Sun Java System Web Server 7.0

   
By Seema Alevoor and Marina Sum, March 16, 2007  

A March 2006 article, Running Roller Weblogger on Sun Java System Web Server 6.1 SP5 , shows you how to configure popular, open-source Roller Weblogger (henceforth, Roller) 2.0 or 2.1.1 on Sun Java System Web Server 6.1 SP5 with MySQL 4.x. Now that Sun Java System Web Server 7.0 (henceforth, Web Server 7.0) is available, this article updates the procedures involved to enable you to run Roller 3.0 on that latest Web Server release.

Note: Type all the commands on one line even though some of them wrap to the next line because of page width constraints.

Contents
 
Fulfilling the Prerequisites
Setting Up Roller
Creating Roller Tables in Your Database
Setting Up the Roller Data Directories and Creating the WAR File
Configuring the JDBC Resource
Deploying the Roller WAR File
Running Roller
Conclusion
References
 
Fulfilling the Prerequisites

First, download Web Server 7.0. Afterward, install and configure the MySQL database.

Setting Up Roller

Second, follow these steps to set up Roller:

  1. Download Roller 3.0. Click the link for Roller 3.0 Web application.

    The file to download is named apache-roller-3.0-incubating.tar.gz.
  2. Unpack the ZIP or TAR file into a temporary directory.

    On UNIX:
    % cp roller-3.0-incubating.tar.gz Roller_temp_dir
    % cd Roller_temp_dir
    % tar xzvf roller-3.0-incubating.tar.gz

    where Roller_temp_dir could be /tmp.

    On Windows:
    Use winzip to extract roller-3.0-incubating.zip into Roller_temp_dir.

    The rest of this article refers to the Roller_temp_dir /apache-roller-3.0-incubating/webapp/roller directory as roller-webapp-dir.
  3. Download Hibernate 3.1.2 from SourceForge. Place the hibernate.tar.gz file in a directory, say, /tmp/hibernate.
  4. Copy the following eight files to the roller-webapp-dir /WEB-INF/lib directory.

    The first file, hibernate3.jar, is in the /tmp/hibernate/hibernate-3.1 directory. The other seven files reside in the /tmp/hibernate/hibernate-3.1/lib directory:

    hibernate3.jar
    dom4j.1.6.1.jar
    asm-attrs.jar
    ehcache-1.1.jar
    asm.jar
    jdbc2_0-stdext.jar
    cglib-2.1.3.jar
    jta.jar
     
Creating Roller Tables in Your Database

Before creating Roller tables, first create a database and a user with the appropriate privileges. Afterward, run the SQL script to create the database tables required to run Roller. The scripts for creating databases for Roller are in the roller-webapp-dir /WEB-INF/dbscripts subdirectory.

The following command lines are an example of how to accomplish the above with MySQL on UNIX. For details on MySQL, see the MySQL Reference Manual .

% cd  
                   roller-webapp-dir/WEB-INF/dbscripts/mysql
% mysql -u root -p
% password: *****
mysql> create database roller;
mysql> grant all on roller.* to scott@'%' identified by 'tiger';
mysql> grant all on roller.* to scott@localhost identified by 'tiger';
mysql> use roller;
mysql> source createdb.sql
mysql> quit
                
 

Note: If you are upgrading the Roller database with the 240-to-300-migration.sql script, before running that script, edit it and change the pagemodels column size from 512 to 255, as follows:

-- add new column which holds the list of custom models in a weblog
alter table website add column pagemodels varchar(255) default null;
 

Otherwise, table updates in Roller will fail and cause runtime errors.

Setting Up the Roller Data Directories and Creating the WAR File

Roller stores uploaded files, search index files, cache files, and log files on disk. Verify that the directories that Roller expects exist and are writable by the Web Server process:

  1. Create a directory for the uploaded files.

    By default, Roller saves the uploaded files in the user.home /roller_data/uploads directory, where user.home is the name of the Java system property that points to the user's home directory.
  2. Create a directory for the search index.

    By default, Roller creates and maintains its text-search index data in the files in the user.home /roller_data/search-index directory.

To change the defaults referred to in the two preceding steps, see steps 7 and 8 of the Apache Roller Installation Guide (PDF) .

Now revise two Roller files and then create the Roller Web archive (WAR) file:

  1. Replace the /j_security_check URI in the roller-webapp-dir /jsps/core/login.jsp file and the roller-webapp-dir /security.xml file with another value, for example, /j_roller_security_check.

    Here's why: j_security_check performs container-managed authentication, which Roller does not use. Leaving j_security_check as the URI causes the Web Server container to authenticate and results in a failure.
  2. Type:

    % cd roller-webapp-dir
    % jar cvf ./roller.war *
Configuring the JDBC Resource

Now configure the Java Database Connectivity (JDBC) resource:

  1. Download the JDBC driver's Java archive (JAR) file for your database.

    For example, the JDBC driver for MySQL is available from the MySQL download site.
  2. Copy the JAR file to the web-server-instance-dir /lib directory.

    Create that directory if it does not exist. At startup, Web Server 7.0 automatically loads the JAR file.
  3. Configure the JDBC resource on the Web Server 7.0 Administration Console:

    1. Log in to the Administration Console.
    2. Select a configuration, for example, test.
    3. Click the Edit Java Settings link in the Configuration Tasks list and click the Resources tab under Java.
    4. Click the JDBC Resources link and then the New button for JDBC resources.

      The Create JDBC Resource wizard is displayed.
    5. Specify the Java Naming and Directory Interface (JNDI) name, as shown in Figure 1. Click Next.

      Figure 1: Specifying the JNDI Name
       
    6. Specify the properties for the JDBC resource. See Figure 2.

      Figure 2: Specifying the Properties for the JDBC Resource
       
      The name in the Datasource Class Name field, only partially visible in Figure 2, is com.mysql.jdbc.jdbc2.optional.MysqlDataSource.
    7. Click Next, verify the settings, and then click Finish and Close.
  4. Apply changes to your Web Server instance: Click the Deployment Pending warning link on the top right corner.

The server.xml file will then contain the following entries:

<jdbc-resource>
    <jndi-name>jdbc/rollerdb</jndi-name>

<datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</datasource-class>
    <property>
        <name>password</name>
        <value>tiger</value>
    </property>
    <property>
        <name>user</name>
        <value>scott</value>
    </property>
    <property>
        <name>databaseName</name>
        <value>roller</value>
    </property>
    <property>
        <name>serverName</name>
        <value>localhost</value>
    </property>
    <property>
        <name>port</name>
        <value>3306</value>
    </property>
    <description></description>
</jdbc-resource>
 
Deploying the Roller WAR File

Finally, deploy the WAR file to Web Server 7.0:

  1. Log in to the Administration Console.
  2. Select a configuration and then a virtual server.
  3. Click the Add Web Application link in the Virtual Server Tasks list.
  4. Specify the location of the roller.war file and type /roller for the URI. Click OK.
  5. Apply changes to your Web Server instance: Click the Deployment Pending warning link on the top right corner.
Running Roller

Now run Roller: Restart Web Server 7.0 and go to http:// web-server-hostname : web-server-portnumber /roller.

Conclusion

The configuration procedure for hosting Roller on Web Server 7.0 is straightforward and intuitive. Given the many robust capabilities that accompany Web Server 7.0, it makes perfect sense to host Roller there.

References
Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
JavaOne Banner Java 8 banner (182)