Dashboard > blojsom 3.0 > ... > Installation > JBoss 4, Linux, PostgreSQL
  blojsom 3.0 Log In   View a printable version of the current page.  
  JBoss 4, Linux, PostgreSQL
Added by Andreas Schaefer, last edited by David Czarnecki on May 21, 2007  (view change)
Labels: 
(None)

This page describes the setup of blojsom using JBoss 4 as the application server and PostgreSQL as the database engine.

Configuration Changes

Items marked in bold in the configuration sections below are values to be changed.

Abbreviation

%BLOJSOM_DEPLOY% stands for %JBOSS_HOME%/server/default/deploy. Also note that the % are delimiters used in this description and are not the DOS style delimiters for environment variable.

Download and Install PostgreSQL

  • Download PostgreSQL and the PostgreSQL JDBC driver.
  • Create a new blojsom database and a user with full privileges for accessing the blojsom database.

Download, Install, and Configure JBoss 4

  • Download and follow the installation instructions for JBoss. Installation notes are available from the JBoss website.
  • Open %BLOJSOM_DEPLOY%/jboss-web.deployer/server.xml file and check out the settings for various defined <Connector .../> elements. Set the URIEncoding attribute to UTF-8, which is the character encoding format blojsom uses for encoding links. For example:
    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080"
       maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
       enableLookups="false" redirectPort="8443" acceptCount="100"
       debug="0" connectionTimeout="20000"
       disableUploadTimeout="true" URIEncoding="UTF-8"/>

blojsom Setup

  • Download the blojsom 3.0 blojsom.war file.
  • Create a web application directory for the blojsom 3.0 WAR file in %BLOJSOM_DEPLOY%.

    % mkdir blojsom.war

  • Copy the blojsom.war file into the %BLOJSOM_DEPLOY%/blojsom.war directory.
  • Unpack the blojsom.war file.

    jar xvf blojsom.war

  • Delete the blojsom.war file.
    JBoss specific Adjustments
    In JBoss you may not need to extract the WAR file but as soon as you need to adjust a configuration file this becomes quite difficult. But you can extract it into a directory carrying a different name like blojsom.3.war so that you know which major version it is. On the other hand you may want to upgrade blojsom from time to time it is not advisable to add the minor version number. Then you can create a %BLOJSOM_DEPLOY%/blojsom.3.war/WEB-INF/jboss-web.xml file that defines the context-root of your blog application.

Database Driver Setup

  • After unpacking the PostgreSQL JDBC Driver, copy the postgresql-8.1-405.jdbc3.jar (or appropriate version) file to %JBOSS_HOME%/server/default/lib.

Configure blojsom's Database Settings

  • Edit %BLOJSOM_DEPLOY%/blojsom.war/WEB-INF/classes/blojsom-helper-beans-include.xml and change the values for the driverClassName, url, username and password for your database to the username and password you created earlier. Be aware the port number that PostgreSQL listens on may be different for your installation of PostgreSQL.
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="org.postgresql.Driver"/>
        <property name="url" value="jdbc:postgresql://localhost:5444/blojsom?charset=utf-8"/>
        <property name="username" value="someuser"/>
        <property name="password" value="somepassword"/>
    </bean>
    JDBC port number
    PostgreSQL listens by default on port 5432. Omit the port number shown above (":5444") to use the PostgreSQL default.When do I use the default? If you have not altered, or otherwise configured your PostgreSQL installation differently, then you are a likely candidate for using the default port.
  • Change the hibernate.dialect property in the definition of the hibernateSessionFactory bean to use the org.hibernate.dialect.PostgreSQLDialect dialect.
    <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="dataSource" ref="dataSource"/>
            <property name="mappingResources">
                <list>
                    <value>Blog.hbm.xml</value>
                    <value>Entry.hbm.xml</value>
                    <value>Category.hbm.xml</value>
                    <value>Comment.hbm.xml</value>
                    <value>Trackback.hbm.xml</value>
                    <value>Pingback.hbm.xml</value>
                    <value>User.hbm.xml</value>
                </list>
            </property>
            <property name="hibernateProperties">
                <props>
                    <prop key="c3p0.min_size">10</prop>
                    <prop key="c3p0.max_size">50</prop>
                    <prop key="c3p0.timeout">1800</prop>
                    <prop key="c3p0.max_statements">100</prop>
                    <prop key="show_sql">false</prop>
                    <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                </props>
            </property>
        </bean>
  • Edit %BLOJSOM_DEPLOY%/blojsom.war/WEB-INF/classes/blojsom.xml. Change the values for the dbScript and detectBlojsomSQL properties to the values below.
    <bean id="dbloader" class="org.blojsom.util.database.DatabaseLoader" init-method="init">
        <property name="sessionFactory">
            <ref bean="hibernateSessionFactory"/>
        </property>
        <property name="dbScript" value="/WEB-INF/classes/blojsom-full-initial-data-postgresql.sql"/>
        <property name="upgrading" value="false"/>
        <property name="servletConfig">
            <ref bean="servletConfigFactoryBean"/>
        </property>
        <property name="detectBlojsomSQL">
            <value>select relname from pg_stat_user_tables where relname = 'blog';</value>
        </property>
    </bean>

Accessing blojsom

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators