You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This article focuses on configuring Apache Roller v3.1 on the Apache Geronimo v1.2 server. Roller is a powerful and popular open source blog server and this document will walk you throw the configuration steps needed to get Roller upp and running with the Derby or MySql database back-end on Geronimo. For detailed information on the usage of JDBC in Geronimo, refer the Simple database access sample application (1.2 Ok) article.

After reading this article you should be able to configure the Geronimo application server for the Apache Roller application with any of the Roller supported databases back-ends.

Work in progress! More content is coming soon but feel free to add more content yourself, suggestions or what ever will help make this a great document.

Apache Roller resources

If you do not already have access to the roller v3.1 application here is:

Included in the apache roller bundle above is database scripts for db2, derby, hsqldb, mysql, mssql and oracle. You will find the scripts in apache-roller/webapp/roller/WEB-INF/dbscripts/

Apache Roller configuration

Make sure you read the roller-install-guide for detailed instructions on setting up Apache Roller. The following is mostly Geronimo specific configuration instructions.

geronimo-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2" 
xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" 
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" 
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>roller</sys:groupId>
      <sys:artifactId>roller</sys:artifactId>
      <sys:version>3.1</sys:version>
      <sys:type>war</sys:type>
    </sys:moduleId>
    <sys:dependencies>  
      <sys:dependency>
         <sys:groupId>console.dbpool</sys:groupId>
         <sys:artifactId>rollerdb</sys:artifactId>
      </sys:dependency>    
    </sys:dependencies>
    <hidden-classes>
        <filter>antlr</filter>
        <filter>org.apache.commons.digester</filter>
    </hidden-classes>
  </sys:environment>

  <context-root>/roller</context-root>

  <sys:resource-ref>
     <sys:ref-name>jdbc/rollerdb</sys:ref-name>
     <sys:resource-link>rollerdb</sys:resource-link>
  </sys:resource-ref> 
  	
    <gbean name="rollerdb_sr" class="org.apache.geronimo.security.realm.GenericSecurityRealm" xsi:type="dep:gbeanType" 
           xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <attribute name="realmName">rollerdb_sr</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-1.2">
                <log:login-module control-flag="REQUIRED" server-side="true" wrap-principals="false">
                    <log:login-domain-name>rollerdb</log:login-domain-name>
                    <log:login-module-class>org.apache.geronimo.security.realm.providers.SQLLoginModule</log:login-module-class>
                    <log:option name="userSelect">SELECT username, passphrase FROM rolleruser WHERE username=?</log:option>
                    <log:option name="dataSourceApplication">null</log:option>
                    <log:option name="groupSelect">SELECT username, rolename FROM userrole WHERE username=?</log:option>
                    <log:option name="dataSourceName">rollerdb</log:option>
                </log:login-module>
            </log:login-config>
        </xml-reference>
    </gbean>
</web-app>
roller-derbydb-plan.xml
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
    <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <dep:moduleId>
            <dep:groupId>console.dbpool</dep:groupId>
            <dep:artifactId>rollerdb</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>rar</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>org.apache.derby</dep:groupId>
                <dep:artifactId>derby</dep:artifactId>
                <dep:version>10.1.3.1</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>rollerdb</name>
                    <config-property-setting name="UserName">the_user</config-property-setting>
                    <config-property-setting name="Password">the_pw</config-property-setting>                    
                    <config-property-setting name="Driver">org.apache.derby.jdbc.EmbeddedDriver</config-property-setting>
                    <config-property-setting name="ConnectionURL">jdbc:derby:roller</config-property-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>
roller-mysqldb-plan.xml
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
    <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <dep:moduleId>
            <dep:groupId>console.dbpool</dep:groupId>
            <dep:artifactId>rollerdb</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>rar</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>org.apache.derby</dep:groupId>
                <dep:artifactId>derby</dep:artifactId>
                <dep:version>10.1.3.1</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>rollerdb</name>
                    <config-property-setting name="UserName">the_user</config-property-setting>
                    <config-property-setting name="Password">the_pw</config-property-setting>                    
                    <config-property-setting name="Driver">org.apache.derby.jdbc.EmbeddedDriver</config-property-setting>
                    <config-property-setting name="ConnectionURL">jdbc:derby:roller</config-property-setting>
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>
rooler-custom.properties

uploads.dir=/var/local/roller/roller_data/uploads
search.index.dir=/var/local/roller/roller_data/search-index

#---------------------------------
# Database configuration settings

# Hibernate dialect: You must override this to use a database other than MySQL4
#hibernate.dialect=org.hibernate.dialect.DerbyDialect
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
  • No labels