Kohei Nozaki's blog 

Install Apache Roller 5.1.0-SNAPSHOT to WildFly


Posted on Friday May 16, 2014 at 05:40PM in Technology


I installed Apache Roller 5.0.3 to WildFly at this article, but unfortunately it was so annoying procedure. Roller 5.0.3 comes with official installation guide to JBoss6, but it seems to be obsoleted for WildFly, so I had to such struggle to install Roller to WildFly.

But, I heard that from a developer of Roller, latest Roller and its installation guide is updated as compatible with newer JBoss version. also some problems at deploying to WildFly are fixed, so it became more easy to deploy to newer JBoss version, so I recommend latest Roller to who wants to use Roller with WildFly. The guide is fine and I guess that it's might be better to read it than this entry.

Environment

  • Apache Roller 5.1.0-SNAPSHOT
  • Apache Maven 3.1.1
  • WildFly 8.1.0.CR1
  • Oracle JDK8u5
  • PostgreSQL 9.2.4
  • OS X 10.9.3

Preconditions

  • Appropriate JDBC driver is already installed.

Procedures

  1. Checkout latest Apache Roller
    svn co https://svn.apache.org/repos/asf/roller/trunk roller_trunk
    
  2. Build
    cd roller_trunk; mvn clean install
    

    The WAR file will be built at roller_trunk/app/target/roller.war

  3. Create a database (with psql)
    create database roller owner wildfly encoding 'UTF8' TEMPLATE template0;
    
  4. Create a DataSource (with jboss-cli)
    data-source add \
     --name=RollerDS \
     --driver-name=postgresql-9.3-1100.jdbc41.jar \
     --connection-url=jdbc:postgresql://localhost:5432/roller \
     --jndi-name=java:/RollerDS \
     --user-name=wildfly \
     --password=*** \
     --check-valid-connection-sql="SELECT 1" \
     --background-validation-millis=60000 \
     --validate-on-match=true \
     --jta=false
    
  5. Set default datasource
    /subsystem=jpa:write-attribute(name=default-datasource, value="java:/RollerDS")
    
  6. Create a JavaMail session
    /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=RollerSMTP:add( \
    host=smtp.gmail.com, \
    port=465)
    
    /subsystem=mail/mail-session=RollerMail:add(jndi-name="java:/RollerMail", from="jane.doe@gmail.example.com", debug=true)
    
    /subsystem=mail/mail-session=RollerMail/server=smtp:add( \
    outbound-socket-binding-ref=RollerSMTP, \
    ssl=true, \
    username=jane.doe@gmail.example.com, \
    password=***)
    

    How to define a JavaMail session using CLI might be useful if you want further information about configuration of JavaMail session for WildFly.

  7. Create a directory at $WILDFLY_HOME/modules/org/apache/roller/configuration/main and put files below
    • module.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.1" name="org.apache.roller.configuration">
         <resources>
             <resource-root path="."/>
         </resources>
      </module> 
      
    • roller-custom.properties
      installation.type=auto
      
      mediafiles.storage.dir=/Users/kyle/tmp/roller510/rollerdata/mediafiles
      search.index.dir=/Users/kyle/tmp/roller510/rollerdata/searchindex
      log4j.appender.roller.File=/Users/kyle/tmp/roller510/rollerdata/roller.log
      
      database.configurationType=jndi
      database.jndi.name=java:/RollerDS
      mail.configurationType=jndi
      mail.jndi.name=java:/RollerMail
      
    • hibernate.cfg.xml
      <hibernate-configuration>
            <session-factory>
               <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL9Dialect</property>
            </session-factory>
      </hibernate-configuration>
      
  8. Restart wildfly
  9. Browse /roller of your application server and do some initializing process
  10. Set installation.type=manual in roller-custom.properties

Remarks

It works fine now, so I would try some customizing and posting with Roller.

I still seeing an error of JavaMail or something. I would investigate it later.

WARN  2014-05-16 16:01:39,233 WebloggerStartup:prepare - Failed to setup mail provider, continuing anyways.
Reason: ERROR connecting to mail server

References

  1. How to Build Roller