This guide describes how to install BellaDati WAR on GlassFish. Please refer to the GlassFish quick start guide or the GlassFish documentation for more information about how to install GlassFish.

BellaDati supports GlassFish 4.1.1 and above (including GlassFish 5.0.1). Please download and install the Glassfish 5 Web Profile.  (https://download.oracle.com/glassfish/5.0.1/release/index.html).

The BellaDati WAR file is the BellaDati application packaged in a WAR archive. It must be deployed into an existing application server and needs to be connected to a data warehouse running on an existing database server.
Deploying BellaDati 2.9 - 2.9.9 requires manual replacement of conflicting glassfish/modules/jboss-logging.jar with newer version of jboss-logging.jar. This action is no more necessary with Glassfish 5.

Before You Begin

Please read the following important notes before you begin installing BellaDati on GlassFish:

 

Watch the video tutorial and or follow guidelines below

1. Setup data warehouse

Please follow the instructions on the Setting up the PostgreSQL Database page.

2. Download and extract BellaDati WAR Archive

Download the BellaDati WAR distribution as a ZIP archive from the BellaDati download page and extract its content using a tool such as 7-Zip for Windows or Linux's GNU tar tools. Only one of the files in the ZIP archive is used for this setup - belladati.war.

(warning)  Avoid using Windows' built-in file extraction tool! This tool silently fails to extract files with long names. Other users have also reported problems with WinRAR.

(warning)  Avoid using Solaris' default tar utility! Please use GNU tar on this operating system to extract BellaDati, as GNU tar handles long file names better.

3. Configure BellaDati WAR

Since version 2.7.14 there is no special configuration change needed, however, there are several advanced settings (e.g. enforcing the SSL), which are configurable in application.properties only.

Configuration settings are explained in detail in the BellaDati WAR Configuration Overview.

4. Configure GlassFish

4.1 Configure Memory Settings in GlassFish

BellaDati requires more memory than what GlassFish provides by default. This may lead to OutOfMemory errors when running BellaDati if these memory settings are not increased.

To increase the available memory, log in into the GlassFish Administration console (by default available at port 4848). Open the Application server's JVM Settings menu and click on JVM Options. Change the setting for -XX:MaxPermSize to 512m and -Xmx to 2048m and change -client to -server as shown in the screenshot below. If any of these options doesn't exist yet, create it. Please make sure you don't have set a -server and -client option at the same time.

If you are using the command line, execute the following commands instead:

$GLASSFISH_HOME/bin/asadmin delete-jvm-options \"-client\"
$GLASSFISH_HOME/bin/asadmin delete-jvm-options \"-Xmx512m\"
$GLASSFISH_HOME/bin/asadmin delete-jvm-options \"-XX:MaxPermSize=192m\"

$GLASSFISH_HOME/bin/asadmin create-jvm-options \"-server\"
$GLASSFISH_HOME/bin/asadmin create-jvm-options \"-Xmx2048m\"
$GLASSFISH_HOME/bin/asadmin create-jvm-options \"-XX:MaxPermSize=512m\"

Restart GlassFish. For other environments and more information on memory settings, see the System Requirements and Recommended JVM Options.

4.2 Configure Thread Pool Settings in GlassFish

We highly recommend to increase maximum thread pool size for thread pools called "http-thread-pool" and "thread-pool-1" in thread pool settings.

  1. Login to Administration console.
  2. Open Configurations->server-config-> Thread Pools
  3. Click on "http-thread-pool", set Max Thread Pool Size to 512 and save this change
  4. Click on "thread-pool-1", set Max Thread Pool Size to 512 and save this change

 

4.3 Configure the GlassFish's JDBC resource

BellaDati uses JDBC resources which connect to the database subsystem. Although BellaDati can connect to the database directly using its own JDBC setup, we recommend using GlassFish's JDBC resources for better performance and more control over the database transaction management. You can set up the JDBC connection pool and JDBC resource following these steps:

4.3.1 Using GlassFish's Administration console

You can use the GlassFish's Administration console as described in the previous step:

1. Login to Administration console.
2. Open Resources->JDBC->Connection Pools and click the New button.
3. Fill the Name, Type and Database Vendor fields and click Next.

4. Specify the database pool settings. The defaults may be fine, but we recommend to set values as shown on the right (see table Recommended connection parameters).

Good idea is to enable ping during pool creation;When enabled, the pool is pinged during creation or reconfiguration to identify and warn of any erroneous values for its attributes

5. In the property list, enter the values matching your system configuration for DatabaseName, User, Password, ServerName and Port. Remove all other properties.

6. After the connection pool was created, select it on the left side and click on tab Advanced. Set Connection Settings and turn on Connection Validation using the settings shown on the right (see table Recommended connection parameters).

 

7. Please test connection by Ping button on the top of Edit JDBC Connection Pool page. You should see Ping Succeeded message.

 

If the ping message is with error: "Classname is wrong or classpath is not set for: org.postgresql.ds.PGConnectionPoolDataSource"

(For example, if JAVA 8 installed , driver postgresql-42.2.2.jar https://mvnrepository.com/artifact/org.postgresql/postgresql/42.2.2 is valid).

  • Restart glassfish and start new JDBC setting up.

    

     

8. Open Resources->JDBC->Resources and click the New button.


9. For JNDI Name, enter the value from jdbc.resource in BellaDati's application.properties. As Pool Name, select the connection pool created during the previous steps.

Recommended connection parameters

Resource Type

javax.sql. ConnectionPoolDataSource

Database Vendor

PostgreSQL

Pool Settings

Initial and Minimum Pool Size

8

Maximum Pool Size

200

Pool Resize Quantity

2

Idle Timeout

300s

Max Wait Time

60000ms

Connection Validation

Connection validation

required

Validate at most once in
240

Validation Method

table

Table Name

pg_tables

On Any Failure

not checked

Allow Non Component callers

not checked

4.3.2 Using the asadmin command

1. Start GlassFish
2. Create a JDBC connection pool:

$GLASSFISH_HOME/bin/asadmin create-jdbc-connection-pool \
--datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource \
--restype javax.sql.ConnectionPoolDataSource --maxpoolsize 200 \
--isconnectvalidatereq=true --validationmethod table --validationtable pg_tables --validateatmostonceperiod 240 \
--property DatabaseName=belladati:User=belladati_dbuser:Password=password:ServerName=db_host belladati_jdbcpool

For DatabaseName, User, Password and ServerName, enter the values matching your system configuration.

3. Create a JDBC resource:

$GLASSFISH_HOME/bin/asadmin create-jdbc-resource --connectionpoolid belladati_jdbcpool jdbc/belladati_db

The jdbc/belladati_db corresponds to the parameter jdbc.resource from BellaDati's application.properties.

5. Deploying BellaDati into GlassFish

5.1 Using GlassFish's Administration console

You can use the Admin Console to deploy BellaDati into GlassFish.

  1. Log in to Administration console.
  2. Open Applications.
  3. Click on the Deploy button.
  4. Click Browse and select the belladati.war file.

5.2 Using the asadmin command

In order to deploy BellaDati, execute this command:

$GLASSFISH_HOME/bin/asadmin deploy --user admin /belladati.war

This command deploys the BellaDati WAR file under the /belladati context.

6. Run the Setup Wizard

Point your browser to http://localhost:8080/belladati. This starts the Setup Wizard, which will take you through BellaDati's setup procedure.

7. Starting/Stopping GlassFish

GlassFish application server can be started/stopped from the command line or by using the service. This differs depending on the operating system used:

7.1 Windows command line

#server start
$GLASSFISH_HOME\bin\asadmin start-domain

 
#server stop
$GLASSFISH_HOME\bin\asadmin stop-domain

7.2 Windows service

If you want to install GlassFish as Windows service, you can either execute the following script or create it using the sc command manually:

$GLASSFISH_HOME\bin\asadmin create-service

Please note, that this script requires the Administrator privileges and .NET 3.5 installed on the machine.

For installing GlassFish 5.0 as Application server, Java 8 up to build 1.8.0_152-b16 is recommended now.