Friday, January 02, 2015

Set up GlassFish 4.1 on Ubuntu 14.04 cloud instance running on RDO Juno

 Procedure bellow in general follows   except updating security rules for TCP
ports 4848, 8080, 8181.
    Actually, same procedure works on Nova-Docker
Container built via image rastasheep/ubuntu-sshd:14.04 ( view  )
with /etc/hosts like :- instance-00000022    localhost instance-00000022
::1    localhost ip6-localhost ip6-loopback
fe00::0    ip6-localnet
ff00::0    ip6-mcastprefix
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters

where floating IP assigned to nova-docker container

Java 8 Set up

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Add lines

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$JAVA_HOME/bin:$PATH

to /etc/bash.bashrc

source /etc/bash.bashrc

Update security rules for TCP ports 4848,8080,8181

Create user boris && copy to /home/boris,
then extract to folder SERVER

boris@ubuntuglassfish41:~/SERVER/glassfish4/bin$ ./asadmin
Use "exit" to exit and "help" for online help.
asadmin> start-database
Starting database in Network Server mode on host and port 1527.
--------- Derby Network Server Information --------
Version: CSS10100/ - (1582446)  Build: 1582446  DRDA Product Id: CSS10100
-- listing properties --
------------------ Java Information ------------------
Java Version:    1.8.0_25
Java Vendor:     Oracle Corporation
Java home:       /usr/lib/jvm/java-8-oracle/jre
Java classpath:  /home/boris/SERVER/glassfish4/glassfish/lib/asadmin/cli-optional.jar:/home/boris/SERVER/glassfish4/javadb/lib/derby.jar:/home/boris/SERVER/glassfish4/javadb/lib/derbytools.jar:/home/boris/SERVER/glassfish4/javadb/lib/derbynet.jar:/home/boris/SERVER/glassfish4/javadb/lib/derbyclient.jar
OS name:         Linux
OS architecture: amd64
OS version:      3.10.0-123.el7.x86_64
Java user name:  boris
Java user home:  /home/boris
Java user dir:   /home/boris/SERVER/glassfish4/bin Java Platform API Specification
java.specification.version: 1.8
java.runtime.version: 1.8.0_25-b17
--------- Derby Information --------
[/home/boris/SERVER/glassfish4/javadb/lib/derby.jar] - (1582446)
[/home/boris/SERVER/glassfish4/javadb/lib/derbytools.jar] - (1582446)
[/home/boris/SERVER/glassfish4/javadb/lib/derbynet.jar] - (1582446)
[/home/boris/SERVER/glassfish4/javadb/lib/derbyclient.jar] - (1582446)
----------------- Locale Information -----------------
Current Locale :  [English/United States [en_US]]
Found support for locale: [cs]
     version: - (1582446)
Found support for locale: [de_DE]
     version: - (1582446)
Found support for locale: [es]
     version: - (1582446)
Found support for locale: [fr]
     version: - (1582446)
Found support for locale: [hu]
     version: - (1582446)
Found support for locale: [it]
     version: - (1582446)
Found support for locale: [ja_JP]
     version: - (1582446)
Found support for locale: [ko_KR]
     version: - (1582446)
Found support for locale: [pl]
     version: - (1582446)
Found support for locale: [pt_BR]
     version: - (1582446)
Found support for locale: [ru]
     version: - (1582446)
Found support for locale: [zh_CN]
     version: - (1582446)
Found support for locale: [zh_TW]
     version: - (1582446)

Starting database in the background.
Log redirected to /home/boris/SERVER/glassfish4/glassfish/databases/derby.log.
Command start-database executed successfully.

asadmin> start-domain
Waiting for domain1 to start ....
Successfully started the domain : domain1
domain  Location: /home/boris/SERVER/glassfish4/glassfish/domains/domain1
Log File: /home/boris/SERVER/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

asadmin> change-admin-password
Enter admin user name [default: admin]>
Enter the admin password>
Enter the new admin password>
Enter the new admin password again>
Command change-admin-password executed successfully.

asadmin> enable-secure-admin
Enter admin user name>  admin
Enter admin password for user "admin">
You must restart all running servers for the change in secure admin to take effect.
Command enable-secure-admin executed successfully.

asadmin> restart-domain
Successfully restarted the domain
Command restart-domain executed successfully.




asadmin> stop-domain
Waiting for the domain to stop .
Command stop-domain executed successfully.
asadmin> stop-database
Thu Jan 01 21:39:41 UTC 2015 : Connection obtained for host:, port number 1527.
Thu Jan 01 21:39:41 UTC 2015 : Apache Derby Network Server - - (1582446) shutdown
Command stop-database executed successfully.

I've also updated Glassfish service :-

root@ubuntuglassfish41:/etc/init.d# cat GlassFish_domain1
#    Created on : Fri Jan 02 09:17:25 UTC 2015
#     Server Type:  Domain


case "$1" in
    $ASADMIN start-database &
    $ASADMIN start-domain    --domaindir /home/boris/SERVER/glassfish4/glassfish/domains  domain1 &
    $ASADMIN stop-database &
    $ASADMIN stop-domain   --domaindir /home/boris/SERVER/glassfish4/glassfish/domains  domain1 &
    $ASADMIN restart-domain   --domaindir /home/boris/SERVER/glassfish4/glassfish/domains  domain1 &
    echo "usage: $0 (start|stop|restart|help)"