Glassfish server installation and Configuration

Here we describe how to install and configure the glassfish Web Application Server. Note: For development using the netbeans IDE you want to use the glassfish server that is bundled with netbeans. In that case you still have to make sure that the G4Expert and G4Admin users are created and that the connection pools and DataSources are created.

we will run the server as user glassfish. So first (as root) we create user glassfish:

/usr/sbin/adduser -d /usr/glassfish4 -m --shell /bin/bash glassfish

Then as user glassfish obtain glassfish from the glassfish download site

wget " target="_blank">]]

cd /usr unzip ~/

chown -R glassfish.glassfish /usr/glassfish4

get jdk from: here Now change the configuration file for glassfish to point to the correct jdk: emacs /usr/glassfish4/glassfish/config/asenv.conf add the line (replace the xxxx with the correct java version AS_JAVA="/usr/java/jdk1..xxxx" Start up scripts: edit /etc/rc.d/init.d/glassfish make sure the glassfish path is set correctly: GLASSFISHPATH=/usr/glassfish4/bin now before starting set the glassfish server set the admin password /usr/glassfish4/bin/asadmin change-admin-password --user admin that will prompt you for the new admin password now start the server and allow for remote administration:

/etc/rc.d/init.d/glassfish start

/usr/glassfish4/bin/asadmin --port 4848 enable-secure-admin

this will ask you for the admin account and password you now can administer the server remotely using the following url in case of the g4devel machine: use the Gui to create the G4Expert and G4Admin account and then to deploy the web application.

Configuring a Connection pool on the Web application Server

Our Web Application and Web Service depend on connection pools (one that connects to the database read only, the other with read/write access for authenticated users) being made available on the web application server (glassfish) as a DataSource. This provides efficient access to the database and avoids that any database info like username, port, dbname and passwords are exposed. Currently the creation and configuration via the web admin gui doesn't seem to work below we list the command line (asadmin) instructions used to set up the pools on the g4devel server providing access to the development database. To be able to use connection pools first one needs to Install the correct jar file containing the PostgreSQL JDBC driver in the domains area:
/usr/glassfish4/glassfish/domains/domain1/lib/ext/postgresql-9.4.1208.jar. The jar file can be obtained from the PostgreSQL download site:

then as user glassfish execute the following command to create the 2 connection pools. These will be started automatically whenever the glassfish server is started.

path_to_glassfish_binaries/asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource --restype javax.sql.ConnectionPoolDataSource --property user=xxxxxx:password=yyyyy:url="jdbc\:postgresql\://\:5453/validationdb" myjdbc_postgres-pool
path_to_glassfish_binaries/asadmin create-jdbc-resource --connectionpoolid myjdbc_postgres-pool DataSource
path_to_glassfish_binaries/asadmin get domain.resources.jdbc-connection-pool.myjdbc_postgres-pool
path_to_glassfish_binaries/asadmin ping-connection-pool myjdbc_postgres-pool

path_to_glassfish_binaries/asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGConnectionPoolDataSource --restype javax.sql.ConnectionPoolDataSource --property user=xxxxxx:password=yyyy:url="jdbc\:postgresql\://\:5453/validationdb" myjdbc_postgres-writerpool
path_to_glassfish_binaries/asadmin create-jdbc-resource --connectionpoolid myjdbc_postgres-writerpool WriterSource
path_to_glassfish_binaries/asadmin get domain.resources.jdbc-connection-pool.myjdbc_postgres-writerpool
path_to_glassfish_binaries/asadmin ping-connection-pool myjdbc_postgres-writerpool

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2016-06-21 - HansWenzel
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Geant4 All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback