Virtual Guru's Blog – Home of Virtualization Workshops

December 10, 2009

Glassfish (GMJ) in OpenSolaris JeOS Prototype with Glassfish V2

Filed under: cloud, jeos, opensolaris, virtualbox, Virtualization — natiku @ 5:05 am

OpenSolaris 200906 JeOS Prototype is PURE CLI enviroment, so its small true command line only enviroment, as such is ideal install BASE for web services like is Glassfish GMJ = Glassfish MySQL Java.

In this example I will demonstrate use of Glassfish GMJ Glassfish V2, MySql 5.1 , Java 6 (JDK) from PKG OpenSolaris 200906 repository OpenSolaris 200906 JeOS Prototype.


General Information – JeOS Prototype OpenSolaris project

Download OpenSolaris 200906 JeOS Prototype VM for one 10+ most popular Virtualization Formats:

JeOS: Just enough OS Project Homepage

OpenSolaris 2009.06 JeOS Prototype VM Images Download

OpenSolaris 2009.06 JeOS Prototype 10 Simple Usage Samples

Discussion jeos-discuss@opensolaris.org (Main page)

Discussion jeos-discuss@opensolaris.org (Archives)

Part 1: Check JeOS readiness as user root

1. Switch to root

pfexec su - root

2a. Check, if PKG will clean download cache on SUCCESS

root@osol-jeos:~# pkg property flush-content-cache-on-success
PROPERTY                       VALUE
flush-content-cache-on-success True

2b. Check, then we increase PKG download patience for slowest networks

root@osol-jeos:~# set | grep PKG
PKG_CLIENT_TIMEOUT=120
PKG_TIMEOUT_MAX=16

2c. Check, then we use right main repository for opensolaris.org

root@osol-jeos:~# pkg publisher
PUBLISHER                             TYPE     STATUS   URI
opensolaris.org          (preferred)  origin   online   http://pkg.opensolaris.org/release/
contrib                               origin   online   http://pkg.opensolaris.org/contrib/

2d. Check, then we can access these repositories

root@osol-jeos:~# pkg refresh --full

2e. Check, opensolaris.org download speed of whole repository catalog

root@osol-jeos:~# curl pkg.opensolaris.org/release/catalog/0 >/dev/null
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 1333k  100 1333k    0     0  93491      0  0:00:14  0:00:14 --:--:--  126k

2f. Check, if we have enough memory and activated swap (I recommend if possible to have VM with 768MB-1GB RAM configured)

root@osol-jeos:~# top | grep Memory
Memory: 1024M phys mem, 525M free mem, 512M total swap, 512M free swap

2g. Check, if you have enough disk space in host, in case then you use a growing Virtual disk Format

At least 2GB of disk space is needed

Part2: Install GLassfish GMJ on OpenSolaris JeOS Prototype

!Glassfish in OpenSoalris 200906 is version V2 and it requires a full JDK6 installation (Which is forced by iPKG dependencies, but one download size can be too large for Virtual Environemnts)

1. Installing full JDK 6 in smaller download chunks

root@osol-jeos:/~# pkg install SUNWj6rt
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1     686/686   31.77/31.77
PHASE                                        ACTIONS
Install Phase                                880/880
Deleting content cache

Next install Java Dev

root@osol-jeos:/~# pkg install SUNWj6dev
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1     284/284   33.53/33.53
PHASE                                        ACTIONS
Install Phase                                351/351
Deleting content cache

Next install rest of Java packages

root@osol-jeos:/~# pkg install SUNWj6dmo SUNWj6dmx SUNWj6rtx SUNWj6dvx SUNWj6man SUNWj6cfg
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    6/6   1960/1960   19.50/19.50
PHASE                                        ACTIONS
Install Phase                              2489/2489
Deleting content cache

You need Japanese localization too 🙂

root@osol-jeos:~# pkg install SUNWj6jmp
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1     121/121     0.58/0.58
PHASE                                        ACTIONS
Install Phase                                138/138
Deleting content cache

2. Install MySQL DB and MySQL JDBC driver in chunks

root@osol-jeos:~# pkg install  SUNWmysql51 SUNWmysql-base
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    2/2     335/335   84.19/84.19
PHASE                                        ACTIONS
Install Phase                                427/427
Deleting content cache
root@osol-jeos:~# pkg install  SUNWmysql51lib
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1         9/9     5.16/5.16
PHASE                                        ACTIONS
Install Phase                                  47/47
Deleting content cache
root@osol-jeos:~# pkg install  SUNWmysql5jdbc
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1       12/12     0.76/0.76
PHASE                                        ACTIONS
Install Phase                                  25/25
Deleting content cache

Don’t forget to add MySQL Connector/J to container JAR PATH

root@osol-jeos:~# pkg contents -m  SUNWmysql5jdbc | grep ".jar" | awk '{print $7}'
path=usr/mysql/connectors/jdbc/5.1/mysql-connector-java-5.1.5-bin.jar

Note: If you will like to use instead a latest MySQL Connector/J 5.1 , get jar at MySQL Connector/J 5.1 {5.1.10}

3. Installing Glassfish V2 package

3a. You can install it as iPKG package

{{
root@osol-jeos:~# pkg install -nv glassfishv2
Creating Plan | Before evaluation:
UNEVALUATED:
+pkg:/glassfishv2@0.5.11,5.11-0.111:20090518T202021Z

After evaluation:
None -> pkg:/glassfishv2@0.5.11,5.11-0.111:20090518T202021Z
None -> pkg:/web/glassfish-2@2.1,5.11-0.111:20090518T202027Z
None -> pkg:/SUNWjavadb@10.4.2.1,5.11-0.111:20090508T161155Z
None -> pkg:/SUNWant@1.7.1,5.11-0.111:20090508T153048Z
None -> pkg:/service/network/message-queue-41@4.1,5.11-0.111:20090508T165024Z
Actuators:

restart_fmri: svc:/system/manifest-import:default

None

root@osol-jeos:~# pkg install glassfishv2
DOWNLOAD PKGS FILES XFER (MB)
web/glassfish-2 1/6 0/4456 0.00/94.85C
}}}

So lets make it in chunked downloads

root@osol-jeos:~# pkg install SUNWjavadb SUNWant
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    2/2   3061/3061   21.32/21.32
PHASE                                        ACTIONS
Install Phase                              3299/3299
Deleting content cache
root@osol-jeos:~# pkg install 'service/network/message-queue-41'
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1     534/534     8.67/8.67
PHASE                                        ACTIONS
Install Phase                                627/627
Deleting content cache
root@osol-jeos:~# pkg install  glassfishv2
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    2/2     740/740   64.29/64.29
PHASE                                        ACTIONS
Install Phase                                921/921
Deleting content cache

3b. Alternate: Installing Glassfish community V2.1.1 Final (63MB download)

root@osol-jeos:~# cd /opt
root@osol-jeos:~#  wget http://java.net/download/javaee5/v2.1.1_branch/promoted/SunOS_X86/glassfish-installer-v2.1.1-b31g-sunos_x86.jar
root@osol-jeos:/opt# java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-sunos_x86.jar
root@osol-jeos:/opt# cd ./glassfish
root@osol-jeos:/opt/glassfish#  chmod -R +x lib/ant/bin
root@osol-jeos:/opt/glassfish#  lib/ant/bin/ant -f setup.xml
...
...
...
create.domain:
[exec] Using port 4848 for Admin.
[exec] Using port 8080 for HTTP Instance.
[exec] Using port 7676 for JMS.
[exec] Using port 3700 for IIOP.
[exec] Using port 8181 for HTTP_SSL.
[exec] Using default port 3820 for IIOP_SSL.
[exec] Using default port 3920 for IIOP_MUTUALAUTH.
[exec] Using default port 8686 for JMX_ADMIN.
[exec] Domain domain1 created.
...

Part 3: Configure and use Glasfish GMJ

See more in related docs:

Getting Started with Glassfish 2.1.1

Glassfish 2.1.1 documentation

Web Stack Getting Started Guide

WebStack OpenSolaris Home

webstack-discuss@opensolaris.org

Advertisements

1 Comment »

  1. […] Glassfish (Glasfish v2, MySQL, Java) in OpenSolaris JeOS Prototype […]

    Pingback by OpenSolaris JeOS (Main Page) « Virtual Guru's Blog – Home of Virtualization Workshops — February 7, 2010 @ 3:49 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: