...
You will later re-pack the roller/... directory into a roller.war file but first we need to set up the database.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | geronimo-web.xml | borderStyle | solid |
---|
| 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>
|
Code Block |
---|
| JAVA |
---|
borderStyle | solid |
---|
title | roller-custom.properties | borderStyle | solid |
---|
| JAVA |
---|
|
#You may whant to set thous two 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.MySQL5Dialect
hibernate.dialect=org.hibernate.dialect.DerbyDialect
|
...
The Roller application is going to access the rollerdb through a connection pool. Below you will find the steps to deploy the the roller database connection pool.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | roller-derbydb-plan.xml | borderStyle | solid |
---|
| 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>
|
...
This is the MySql rollerdb plan just change the hibernate dialect setting in the roller-custom.properties re-pack the roller.war, create, build the database, deploy the plan and you will have roller up and running with the mysql database back end in minutes.
Code Block |
---|
| xml |
---|
borderStyle | solid |
---|
title | roller-mysqldb-plan.xml | borderStyle | solid |
---|
| 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>mysql</dep:groupId>
<dep:artifactId>mysql-connector-java</dep:artifactId>
<dep:version>3.1.12</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">com.mysql.jdbc.Driver</config-property-setting>
<config-property-setting name="ConnectionURL">jdbc:mysql://localhost:3306/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>
|
...
Hopefully this section eventually can be removed but at this writing there are a couple of things to look out for fortunately there are solutions. If you hit the following problem wile running Roller on Geronimo you should upgrade to a newer build of Geronimo 1.2 as this problem has been addressed by the developers.
Code Block |
---|
| JAVA |
---|
borderStyle | solid |
---|
title | Geronimo log message | borderStyle | solid |
---|
| JAVA |
---|
|
--- ROOT CAUSE ---
java.lang.NullPointerException
at org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator.handleReleased(ConnectionTrackingCoordinator.java:127)
at org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator$$FastClassByCGLIB$$5d33aabf.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
|
If this error shows up in your Geronimo log wile starting Roller you are running in to a hibernate property loading problem. Hibernate is swalowing the activemq properties witout checking it first (this has been addressed in a newer versions of hibernate (3.2)).
Code Block |
---|
| JAVA |
---|
borderStyle | solid |
---|
title | Geronimo log message | borderStyle | solid |
---|
| JAVA |
---|
|
13:13:34,849 FATAL [HibernateRollerImpl] Error initializing Hibernate
java.lang.ClassCastException: java.util.HashSet
at org.hibernate.util.PropertiesHelper.resolvePlaceHolders(PropertiesHelper.java:88)
|
...