Posts Tagged ‘Glassfish’

How-To Deploy Roller 4 on GlassFish V3

December 10, 2009 7 comments

I’ve just started blogging seriously. Many free blogging tool providers are available. Widely known are the WordPress and Blogger. For some reasons, I decided to use WordPress as my main blogging tool.

I’ve given some thoughts to start developing a Web-based Blogging Tool just to have some hands-on experience on the Web Development and Design process. Besides, as I advocate the Open Source Community I would like to make a humble contribution to this great community.

I was wondering which platform on which I should rely to start developing this project. From my notice, most web applications nowadays are developed in PHP. PHP has been used very widely by the public. Well, PHP is a very cool scripting language and I’ve always looked forward to learning it. But, as it is a top priority to my career path is to have a solid development background using Java/J2EE technology, I’ve decided to start a project for developing a Java Web-based Blogging Application. Fortunately, somebody already started developing such a project long time ago, since 2002. This application is sponsored by Apache Software Foundation and is called Roller Weblogger.

So, trying to make Roller up and running, we need to download a Java Web Server to be the deploying environment for Roller. You can download Tomcat and use it as a Web Server to deploy Roller. Refer to this Installation Guide to deploy Roller on Tomcat.

In my case, I decided to use GlassfishV3 due to the features and frameworks bundled with. Here, I’ll explain step by step how to install GlassfishV3, deploy Roller on it, and avoid a possible problem that might hinder the deployment process!

So, let’s start!

STEP 1: GlassfishV3

STEP 1.1: Download GlassfishV3

Download GlassFishV3 Prelude or Preview. Compare between them here.

Refer to Comment#:1

STEP 1.2: Install/Configure GlassfishV3

Install GlassfishV3 by simply running the script. It is not a big deal just follow the instructions!

STEP 1.3: Start GlassfishV3

Go to where Glassfish binary files are:

cd $GF_HOME/glassfish/bin
  • To start the domain:
    ./asadmin start-domain
  • To stop the domain:
    ./asadmin stop-domain

Or alternatively, I prefer to start/stop the server by running these: “log will be output to the screen, so you can monitor it

  • To start the server:
  • To stop server:

Now, you can reach the Admin Console at:

For further details, have a look at the GlassfishV3 Quick Start Guide!

STEP 2: MySQL JDBC Connection

STEP 2.1: Download Connector/J

You will need to download the MySQL JDBC Connector to allow Roller interact with the MySQL Database Server. Here, I used the MySQL Connector/J 5.1.10.

Place the Connector/J in:

cp mysql-connector-java-5.1.10-bin.jar $GF_HOME/glassfish/lib/

STEP 2.2: Provide JNDI

In GlassfishV3:

  • Create JDBC Connection Pool: (Admin GUI -> Application Server -> Resources -> JDBC -> Connection Pools)

  • Create JDBC Resources (Admin GUI -> Application Server -> Resources -> JDBC -> JDBC Resources)

Restart Glassfish and Ping the JDBC Connection!

STEP 3: Roller 4

STEP 3.1: Download Roller

Download Roller from here.
For more detailed information about installation refer to the Roller Installation Guide!

STEP 3.2: Create Database
mysql -u root -p

password: *****
create database rollerdb;

grant all on rollerdb.* to scott@'%' identified by 'tiger';

grant all on rollerdb.* to scott@localhost identified by 'tiger';

STEP 3.3: Create

To connect to the MySQL database you should create the file in either 2 ways “as far as I noticed“:

  • Roller will interact with database Directly:

    Place it in:

    mv $ROLLER_DIR/WEB-INF/classes/
  • Roller will interact with database through the JNDI:

    Place it in:

    mv $ROLLER_DIR/WEB-INF/classes/

    Make sure that the following Descriptor is placed in this directory:

    ls $ROLLER_DIR/WEB-INF/sun-web.xml
STEP 3.4: Deploy Roller

Deployment must be easy and straightforward too from the Admin GUI, or You can place the $ROLLER_DIR in the autodeploy directory if you want just to try it out.

STEP 4: A Problem To Be Avoid

I only got Roller and GlassFishV3 working together by disabling the following JPA configuration and setting its flag to false and then adding it to ““:

Enjoy blogging 😉