Container Config in GlassFish V3

As of today, GlassFish V3 supports four types of applications each served by a particular container :

  1. Web Applications
  2. Ruby on Rails using JRuby 0.9.9
  3. Phobos using the phobos runtime
  4. PHP using the resin quercus engine.

This page will describe all the steps necessary to install these containers prior to start deploying artifacts to them. In a future build, we will most likely install these containers as the deployment request is made but this is not implemented yet so for now, you have to do it manually.

Web Applications

The web container is bundled with the GlassFish v3 installation so there is nothing that needs to be done to run servlets and jsp. We have not tried yet JSF.

Ruby On Rails

More detailed instructions are available here are here.

First you need to download the JRuby latest release from http://jruby.codehaus.org/ and install it either in the glassfish's installation lib directory under the jruby directory or install it anywhere and have jruby.home property in <glassfish>/config/asenv.conf pointing to it.

After that you just need to download and deploy a RoR application, you should not have to modify the RoR application except for the database connectivity. Existing RoR apps use native drivers to access the database, however when running in Java this is not the best option so you usally need to modify the RoR application to change that. Let's review this taking mephisto as an example :

  • Download Mephisto at http://mephistoblog.com/
  • Install MySQL
  • Expand the downloaded zip in say mephisto directory
  • change the mephisto/config/database.yml to have the following bindings :
development:
    adapter: jdbc
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/mephisto
    username: dochez
    password: noway
if RUBY_PLATFORM =~ /java/
  require 'rubygems'
  RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end
  • deploy the application
asadmin deploy --path mephisto

Phobos installations

Same as above, just install the binaries in <glassfish>lib/phobos or have phobos.home in asenv.conf pointing to your installation. Go the phobos documentation on how to configure phobos. Please note that we do not support yet the persistence bindings in Phobos, this should be done right after JavaOne 2007.

PHP

PHP installation is a bit more complicated mostly because the Resin Quercus engine is not available in a public maven reposistory. So you need to follow these steps :

cp WEB-INF/lib/resin-util.jar <glassfish>/lib/jars/resin-util-3.1.jar
cp WEB-INF/lib/quercus.jar <glassfish>/lib/jars/quercus-3.1.jar
cp index.php <glassfish>/domains/domain1/docroot

Warning : the PHP integration in GlassFish V3 is not complete and you will probably run into issues. We need to upgrade to Grizzly 1.5 and resolve a few other issues before this will be fully functional.