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 http://download.oracle.com/glassfish/4.1/release

wget " target="_blank">http://download.oracle.com/glassfish/4.1/release/glassfish-4.1.zip]]

cd /usr unzip ~/glassfish-4.1.zip

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: https://g4devel.fnal.gov:4848/ 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 a connection pools (one that connects to the database read only, the other with read/write access for authentcated 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 db. Install the correct jar file in the domains area:
/usr/glassfish4/glassfish/domains/domain1/lib/postgresql-9.4.1208.jar
or:
/usr/glassfish4/glassfish/domains/domain1/lib/ext/postgresql-9.4.1208.jar The jar file can be obtained from the PostgreSQL download site: https://jdbc.postgresql.org/download.html

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\://fnalpgsdev.fnal.gov\: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\://fnalpgsdev.fnal.gov\: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 | Raw edit | More topic actions...
Topic revision: r3 - 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