Finally, got osgi hot deployed in Glassfish V3!

The tricky part is, no matter what the online tutorials say (/opt/SUNWappserver/domains/domain1/autodeploy/bundles), the default hot deploy folder out of box for Glassfish V 3.0.1 for osgi auto deployment is:

/opt/SUNWappserver/domains/domain1/config/load

as indicated below:

[#|2010-11-11T16:53:20.863-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|{felix.fileinstall.poll (ms) = 2000, felix.fileinstall.dir = /opt/SUNWappserver/domains/domain1/config/./load, felix.fileinstall.debug = -1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /tmp/fileinstall--5626012334122035867, felix.fileinstall.filter = null}|#]

After I did the following,

cp  /opt/SUNWappserver/domains/domain1/autodeploy/bundles/plugins/HelloOSGi_1.0.0.jar  /opt/SUNWappserver/domains/domain1/config/load/

all works as expected:

[#|2010-11-11T16:53:20.857-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=11;_ThreadName=Thread-1;|Hello World!!|#]

[#|2010-11-11T16:53:20.863-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|{felix.fileinstall.poll (ms) = 2000, felix.fileinstall.dir = /opt/SUNWappserver/domains/domain1/config/./load, felix.fileinstall.debug = -1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = /tmp/fileinstall--5626012334122035867, felix.fileinstall.filter = null}|#]

[#|2010-11-11T16:53:20.868-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Goodbye World!!|#]

[#|2010-11-11T16:53:20.876-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Hello World!!|#]

[#|2010-11-11T16:53:20.876-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Updated /opt/SUNWappserver/domains/domain1/config/load/HelloOSGi_1.0.0.jar|#]

[#|2010-11-11T16:53:22.882-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|A bundle with the same symbolic name (HelloOSGi) and version (1.0.0) is already installed.  Updating this bundle instead.|#]

[#|2010-11-11T16:53:22.883-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Goodbye World!!|#]

[#|2010-11-11T16:53:22.893-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Hello World!!|#]

[#|2010-11-11T16:53:22.893-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Installed ./load/HelloOSGi_1.0.0.jar|#]

[#|2010-11-11T16:53:22.894-0500|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=17;_ThreadName=Thread-1;|Started bundle: file:/opt/SUNWappserver/domains/domain1/config/./load/HelloOSGi_1.0.0.jar|#]

How to enable Eclipse/Glassfish remote debugging

You would normally enable jdb by adding debug options into your Java start up command by attaching debugging into JVM process, like the following:

DEBUG_OPTS=”-Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend
=n”

You would consider adding this into your Glassfish’s(V2, in my case) start up script asadmin as below:

“$AS_JAVA”/bin/java “$DEBUG_OPTS” -Dcom.sun.aas.instanceName=server -Djava.libra
ry.path=”$AS_NSS”:”$AS_INSTALL/lib”:”$AS_ICU_LIB” -Dcom.sun.aas.configRoot=”$AS_
CONFIG” -Djava.endorsed.dirs=”$AS_INSTALL/lib/endorsed” -Dcom.sun.aas.processLau
ncher=”SE” -cp “$AS_DERBY_INSTALL/lib/derby.jar”:”$AS_INSTALL/jbi/lib/jbi-admin-
cli.jar”:”$AS_INSTALL/jbi/lib/jbi-admin-common.jar”:”$AS_INSTALL/lib”:”$AS_INSTA
LL/lib/appserv-rt.jar”:”$AS_INSTALL/lib/appserv-ext.jar”:”$AS_INSTALL/lib/javaee
.jar”:”$AS_INSTALL/lib/appserv-se.jar”:”$AS_INSTALL/lib/admin-cli.jar”:”$AS_INST
ALL/lib/appserv-admin.jar”:”$AS_INSTALL/lib/commons-launcher.jar”:”$AS_INSTALL/l
ib/install/applications/jmsra/imqjmsra.jar” -Dcom.sun.appserv.admin.pluggable.fe
atures=com.sun.enterprise.ee.admin.pluggable.EEClientPluggableFeatureImpl com.su
n.enterprise.cli.framework.CLIMain “${@}”

Actually this will not work.

You have to log into the Glassfish admin console, under:

Application server

JVM General Settings

Debug
Enabled (check it)

Hit save

Restart Glassfish.

You’ll see Glassfish start up script spits the following message:

Listening for transport dt_socket at address: 9009
Application server is listening at address 9009 for debugger to attach using transport dt_socket

It started to listen at port 9009 by default instead of 1044.

You’ll configure your Eclipse accordingly to do remote debugging. Remember the port number 9009 instead of 1044.