Child pages
  • Install WAR on GlassFish3
Skip to end of metadata
Go to start of metadata
We're assuming that you already have a working installation of Glassfish 3 and that you have initialized your MySQL or PostgreSQL database


Connecting your database to Glassfish

  1. Glassfish is not bundled with JDBC drivers for MySQL or PostgreSQL. Depending on which database you want to use, download the appropriate driver for either MySQL or PostgreSQL. Copy the jar file containing the driver to [glassfish_home]/glassfish/domains/domain1/lib/
  2. Restart Glassfish to have it load the new database driver
  3. Enter in the administration console(defaults to http://localhost:4848) and navigate the left tree to Resources/JDBC/Connection Pools.
  4. Click new and enter the following values:
    1. Pool Name: eHour
    2. Resource Type: java.sql.Driver
    3. Database driver vendor: MySQL or PostgreSQL
    4. Introspect: enabled
  5. Click next, tick enable ping and in the additional properties (at the bottom) enter:
    1. user: your database user
    2. password: your database password
    3. URL:   jdbc:postgresql://localhost:5432/ehour  (replace ehour with your local database name)
  6. Click finish. When you enabled ping, click on the eHour datasource and in the following screen, hit Ping. When you get a "Ping succeeded" you successfully connected Glassfish to your database


Registering the connection

  1. In the administration console navigate to Resources/JDBC/JDBC Resources and click new. Enter the following values:
    1. JNDI Name: jdbc/eHourDS
    2. Pool name: eHour (it's the name you entered when creating the connection)
  2. Click ok 



Defining ehour_home

  1. In the administration console navigate to Configurations/server-config (or whichever server configuration is your active configuration)
  2. Select System Properties
  3. Click on Add Property and fill out:
    1. Instance variable name: EHOUR_HOME
    2. Default value: the path to your eHour Home directory (where you unpacked the eHour zip)

Check configuration

  1. Open the, make sure that the ehour.database property is set to the proper database type (postgres or mysql)

Deploy application

  1. In the administration console navigate to Applications and click Deploy
  2. Click choose file and select the war in the app dir in ehour app (ehour-1.1.war)
  3. Set the context root to ehour
  4. Set the application name to ehour
  5. Click ok
  6. Navigate to http://localhost:8080/ehour et voila!


  • No labels