1. GlassFish Application Server

1.1. Installation

Make sure that the version of Java that your system is using is the Oracle Java SE 6 JDK and not OpenJDK (check this in a terminal window with java -version). If you need to install the Oracle JDK, download Java 6 from the Oracle site and use the update-alternatives utility (see Installing Oracle Java SE 6 for more details)

Create the glassfish user and group. Add the current user along with any other users that should have glassfish admin privileges to the new group.

$ sudo adduser --system --no-create-home glassfish --group $ sudo usermod -a -G <user< glassfish

Log out and log in again with the current user to update the groups. Next, download the Glassfish zip file from http://www.oracle.com/technetwork/middleware/glassfish/overview/index.html. Unzip this file and move the glassfish3 directory to /usr/share/:

$ sudo unzip ogs- $ sudo mv glassfish3 /usr/share/

Copy the JDBC MySQL driver included with glassfish (mysql-connector-java-commercial-5.1.14-bin.jar) to the glassfish/lib directory:

$ sudo cp /usr/share/glassfish3/mysql-connector-java-commercial/mysql-connector-java-commercial-5.1.14-bin.jar /usr/share/glassfish3/glassfish/lib/

Change ownership of the glassfish directory to user glassfish and group glassfish:

$ sudo chown -R glassfish:glassfish /usr/share/glassfish3

Copy the example startup script for glassfish from /etc/filteredpush/scripts/glassfish to /etc/init.d/ and make the script executable via the chmod command.

$ sudo cp /etc/filteredpush/glassfish /etc/init.d/ $ sudo chmod +x /etc/init.d/glassfish

Edit the script and make sure that the JAVA_HOME variable is set to point to the base directory of the Oracle JDK 6. Once you have finished editing the script, install it using the update-rc.d command in terminal. This command will allow the script to automatically start the server on boot and stop it during shutdown:

$ sudo update-rc.d glassfish defaults

Start Glassfish via the startup script. The first time you start Glassfish you will be prompted to set the administrative password for the domain:

$sudo /etc/init.d/glassfish start Starting Glassfish: This domain requires an administrative password to be set before the domain can be started. Please specify an administrative password. Enter an admin password for user "admin"

If you plan on using the admin control panel remotely via a web browser, you must configure the admin user and password and secure access via the asadmin utillity from shell:

$ sudo /usr/share/glassfish3/glassfish/bin/asadmin enable-secure-admin --port 4848

1.2 Configuration

Once glassfish has started, navigate to the admin control panel at http://localhost:4848 in a browser window. Enter your admin username and password (default username is admin).

On the left side of the control panel page select Resources > JDBC > JDBC Connection Pools and create a new connection pool with the name "mysql_messagestore". Select "java.sql.ConnectionPoolDataSource" as the Resource Type and "MySQL" as the Database Driver Vendor from the dropdowns before clicking next.

In step two, you should configure the User, Password, DatabaseName, URL and Url properties for the messagestore database:

User: messagestore Password: <password> DatabaseName: messagestore URL: jdbc:mysql://:3306/messagestore Url: jdbc:mysql://:3306/messagestore (note that there are two properties for the url)

Once you have done this click the finish button. Select the connection pool again from the list and on the edit page click the "Ping" button to test your configuration (you should get a "Ping Succeeded message").

Now from the list to the left of the control panel, select Resources > JDBC > JDBC Resources and create a new resource with the name "jdbc/mysql_messagestore". Select the mysql_messagestore connection pool you just created from the "Pool Name" dropdown box and click OK to finish.

NOTE: if you end up using a different name for your connection pools you must edit the persistence.xml file in the src/main/resources/META-INF directory of the affected projects.

Now we repeat the process for the fpannotationprocessor database and fpweb user. Create a new connection pool with the name "mysql_fpannotationprocessor" with Resource Type "java.sql.ConnectionPoolDataSource" and Database Driver Vendor "MySQL" in Resources > JDBC > JDBC Connection Pools. Configure the properties on the next page using the following values:

User: fpweb Password: <password> DatabaseName: fpannotationprocessor URL: jdbc:mysql://:3306/fpannotationprocessor Url: jdbc:mysql://:3306/fpannotationprocessor/div>

After clicking the Finish button, select the connection pool from the list and click "Ping" to test the connection.

Create a new JDBC resource with the name "jdbc/fpannotationprocessor" in Resources > JDBC > JDBC Resources and select the mysql_fpannotationprocessor connection pool from the "Pool Name" dropdown before clicking OK to finish.