Tuesday September 15, 2009
TOTD #103: GlassFish v3 with different OSGi runtimes – Felix, Equinox, and Knoplerfish
GlassFish v3 uses standard OSGi APIs to achieve modularity. It bundles Apache Felix 2.0 as the OSGi runtime and can run on any other OSGi R4.1 compliant runtimes as well. This blog will use previously described instructions and show how to run GlassFish v3 on Eclipse Equinox and Knoplerfish. The complete details about different OSGi runtimes is described here, this TOTD provide detailed steps and overrides the instructions defined here (and here and here).
This blog is using a CI build from last week but you should try the instructions on a promoted build.
GlassFish with Felix - Felix 2.0.0 is bundled with GlassFish v3 and requires no additional configurations.
~/tools/glassfish/v3/2269/glassfishv3/glassfish >./bin/asadmin start-domain --verbose
Sep 11, 2009 4:41:16 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Felix platform
Welcome to Felix
================
. . .
Sep 11, 2009 4:41:30 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish v3 startup time : Felix(9669ms) startup services(4453ms) total(14122ms)
Optionally, connect to Felix runtime using Apache Felix Remote Shell (described here) as:
~/tools/glassfish/v3/2269/glassfishv3 >telnet localhost 6666
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Felix Remote Shell Console:
============================
->
and type "help" to see the list of commands available as:
-> help
bundlelevel
cd
find
headers
help
inspect
install
log
ps
refresh
resolve
shutdown
start
startlevel
stop
uninstall
update
version
Use 'help ' for more information.
-> ps
START LEVEL 1
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (2.0.0)
[ 1] [Active ] [ 1] HK2 OSGi Main Bundle (0.3.91)
[ 2] [Installed ] [ 1] EclipseLink Core (2.0.0.v20090821-r4934)
[ 3] [Resolved ] [ 1] Hibernate validator library and Validation API (JSR 303) repackaged as OSGi and HK2 bundle (3.0.0.JBoss-400Beta3)
[ 4] [Installed ] [ 1] Connector (gluecode) for GlassFish Java EE Connector Architecture Runtime (3.0.0.SNAPSHOT)
[ 5] [Active ] [ 1] GlassFish Flashlight Framework (3.0.0.SNAPSHOT)
. . .
[ 201] [Resolved ] [ 1] glassfish-corba-asm (3.0.0.b024)
[ 202] [Resolved ] [ 1] MIME streaming extension (1.4)
[ 203] [Installed ] [ 1] Admin Console Connectors Plugin (3.0.0.SNAPSHOT)
[ 204] [Installed ] [ 1] Apache Felix Shell TUI (1.4.0)
[ 205] [Resolved ] [ 1] org.glassfish.core.glassfish-extra-jre-packages
GlassFish on Equinox
~/tools/glassfish/v3/2269/glassfishv3/glassfish >unzip ~/Downloads/equinox-SDK-3.5.zip -d ~/tools/equinox-3.5
~/tools/glassfish/v3/2269/glassfishv3/glassfish >cp ~/tools/equinox-3.5/plugins/org.eclipse.osgi_3.5.0.v20090520.jar ./osgi/equinox
~/tools/glassfish/v3/2269/glassfishv3 >GlassFish_Platform=Equinox ./bin/asadmin start-domain --verbose
Sep 11, 2009 5:11:13 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Equinox platform
Listening on port 6667 ...
. . .
Sep 11, 2009 5:11:19 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish v3 startup time : Equinox(3649ms) startup services(1843ms) total(5492ms)
~/tools/glassfish/v3/2269/glassfishv3/glassfish >telnet localhost 6667
Trying ::1...
Connected to localhost.
Escape character is '^]'.
osgi>
osgi> help
---Controlling the OSGi framework---
launch - start the OSGi Framework
shutdown - shutdown the OSGi Framework
close - shutdown and exit
exit - exit immediately (System.exit)
init - uninstall all bundles
setprop = - set the OSGi property
---Controlling Bundles---
. . .
---Controlling the Console---
more - More prompt for console output
disconnect - Disconnects from telnet session
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20090520
Fragments=62, 128, 205
1 ACTIVE com.sun.enterprise.osgi-main_0.3.91
2 RESOLVED org.eclipse.persistence.core_2.0.0.v20090821-r4934
Fragments=136
. . .
203 RESOLVED org.glassfish.admingui.console-jca-plugin_3.0.0.SNAPSHOT
204 RESOLVED org.apache.felix.shell.tui_1.4.0
205 RESOLVED org.glassfish.core.glassfish-extra-jre-packages_0.0.0
Master=0
GlassFish with Knoplerfish - As mentioned here, GlassFish v3 requires at least R4.1 APIs. All Knopflerfish releases prior to 3.0.0 are R4 compliant and so will not work with the GlassFish v3 latest builds. Knopflerfish 3.0.0 beta1 is the first build that is R4.2 compliant but it does not start on Mac OS X 10.5.8 as described in issue #2858798. So until then, you you can follow the instructions documented at GlassFish v3 on OSGi KnopflerFish and Using KnopflerFish Desktop in GlassFish v3 to get them running on GlassFish v3 TP2 or Prelude.
Some additional details missing form the entries above
~/tools/glassfish/v3/2269/glassfishv3/glassfish >KNOPFLERFISH_HOME=/Users/arungupta/tools/knopflerfish_osgi_2.3.3/knopflerfish.org/osgi GlassFish_Platform=Knopflerfish ./bin/asadmin start-domain --verbose
and see the following messages in the log:
Knopflerfish OSGi framework, version 4.1.10
Copyright 2003-2009 Knopflerfish. All Rights Reserved.
See http://www.knopflerfish.org for more information.
Loading xargs url file:/Users/arungupta/tools/knopflerfish_osgi_2.3.3/knopflerfish.org/osgi/gf.xargs
Removed existing fwdir /Users/arungupta/tools/knopflerfish_osgi_2.3.3/knopflerfish.org/osgi/fwdir
Installed: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/tiger-types-osgi-0.2.1.jar (id#1)
Installed: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/auto-depends-0.2.1.jar (id#2)
Installed: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/config-0.2.1.jar (id#3)
. . .
Started: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/cm_all-2.0.1.jar (id#7)
Started: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/console_all-2.0.1.jar (id#8)
Started: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/desktop_all-2.3.11.jar (id#11)

The instructions will be updated after a more stable release of Knopflerfish is available.
A complete archive of all the tips is available here.
Technorati: totd glassfish v3 osgi apache felix eclipse equinox knopflerfish
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Today's Page Hits: 1201
Total # blog entries: 1025