Miles to go …

January 29, 2010

Developer Tools Strategy by Oracle+Sun: NetBeans & Hudson to stay!

Filed under: General — arungupta @ 4:43 am

Hear Ted Farrell, Chief Architect and Senior Vice President talk about Oracle and Sun Java Developer Tools Strategy.

Here is a summary for those who want a quick juice:

  • Productivity With Choice
    • Choose the right tool set for your needs
    • Shared infrastructure across tools with Hudson, Oracle TPC, Subversion. Bugzilla, Maven, etc.
    • NetBeans continues with strong Java focus
    • Combine and integrate the best features across tools
  • More resources for Developers
    • More courses/training on Java technologies
    • More conferences around the world
    • Better products from expanded R&D and partner ecosystem
    • Larger combined developer community

Here is a lovely snapshot from the webcast …

Some more detailed points captured from the webcast …

  • If you are a NetBeans user today, you’ll continue to be a NetBeans user after acquisition.
  • Increase the investment in Hudson, lots of synergy with Team Productivity Center.
  • Discontinue the public interface for for now, fits very well with some internal projects. Read more about the future of
  • Want to make the best Java IDE for the Java platform. NetBeans platform is very important to lot of customers.
  • For NetBeans, turn to community for external non-Java like Dynamic Languages. Invest more in the infrastructure and community.
  • unchanged
  • Community participation is key for:
    • NetBeans plug-ins
    • Building apps on NetBeans Platform
    • Emerging, Dynamic Languages
    • Dialog, interaction, lists, docs, events, JUGS, etc
  • No licensing changes
    • Versions of NetBeans <= 6.7 follow Sun policy
    • Versions of NetBeans >= 6.8 follow the Oracle policy (complete details)

The webcast also talks about JavaOne being co-located with Oracle Open World (Se 19-23, 2010) and also expanding to Brazil, Russia, India, and China. for more details. The complete list of webcasts + slides from yesterday’s event are now available.

There are several other articles (in no particular order):

  • Oracle reveals strategy forGlassFish, MySQL, OpenOffice, and Solaris
  • Oracle’s roadmap for Sun Technologies
  • The Sun has not set: Oracle makes Sun shine
  • Sun + Oracle, NetBeans, Glassfish, JavaOne and the Death of Kenai

Also check out the FAQ for Developer Community.

Technorati: sun oracle netbeans kenai hudson strategy

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 28, 2010

GlassFish strategy by Oracle+Sun

Filed under: General — arungupta @ 12:24 pm

Hear Hasan Rizvi, Senior Vice President, Oracle Fusion Middleware, talk about GlassFish in Oracle and Sun Application Server Strategy webcast. The first part of the webcast is about the overall strategy and then the GlassFish part starts around 5:23 in the video.

Here is a summary for those who want a quick juice:

  • GlassFish joins WebLogic Server in the best java EE application server offering in the industry
  • GlassFish continues as the Java EE reference implementation
  • HotSpot and Java System Web Server augment Oracle’s application grid portfolio to provide the most comprehensive, integrated, and open middleware foundation
  • All existing customers current on support will be fully supported according to their existing agreements

Some more detailed points captured from the webcast …

  • GlassFish continues as the Java EE reference implementation and as an open source project.
  • Oracle’s strategic application server, Oracle WebLogic Server, together with GlassFish, provide world class Java EE infrastructure.
  • GlassFish Enterprise Server and WebLogic Server expected to share core components.
  • Oracle plans to add GlassFish Enterprise Server all WebLogic offerings.
  • Hotspot and JRockit become Oracle’s strategic JVMs.
  • Java System Web Server part of new Oracle Web Tier offering.
  • GlassFish Web Stack maintained for existing customers.
  • GlassFish Message Queue remains as the GlassFish messaging infrastructure.
  • Oracle plans to license GlassFish Enterprise Server and Java System Web Server with all WebLogic Server offerings.
  • GlassFish also available as standalone offering.
  • GlassFish will continue to be supported and maintained for an extended time period for customers current on support.
    • GlassFish v2.1 supported until Jan 2013 (Premium) / Jan 2015 (Extended) / Indefinite (Sustaining)
    • GlassFish v3 supported until Dec 2014 (Premium) / Dec 2017 (Extended) / Indefinite (Sustaining)
    • Full details at
  • GlassFish open source projects thrive
  • On-going commitment by Oracle to and other open source projects that make up GlassFish
    • Continue collaboration
    • Blogs – TheAquarium
    • Enhancements –
    • GlassFish wiki for more details. The complete list of webcasts on Oracle Fusion Middleware Strategy shares the overall strategy (still evolving).

Also checkout the slides presented by Thomas Kurian on Software Strategy at the webcast yesterday. The complete list of webcasts + slides from yesterday’s event are now available.

There are several other articles (in no particular order):

  • Oracle reveals strategy forGlassFish, MySQL, OpenOffice, and Solaris
  • Oracle’s roadmap for Sun Technologies
  • The Sun has not set: Oracle makes Sun shine
  • Sun + Oracle, NetBeans, Glassfish, JavaOne and the Death of Kenai

Also check out the FAQ for Developer Community.

Technorati: sun oracle glassfish strategy

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 22, 2010

TOTD #119: Telnet to GlassFish v3 with NetBeans 6.8 – “Could not open connection to the host”

Filed under: General — arungupta @ 2:00 am

As explained in TOTD #118, one of the ways to manage OSGi bundles in GlassFish is by giving the command "telnet localhost 6666".

This straight forward command works fine if you installed either the Sun GlassFish Enterprise Server or the GlassFish community bits. The "domain.xml" in both of them is pre-configured for the telnet port to 6666 using the "jvm-options" as shown below:


However if you installed GlassFish as part of NetBeans 6.8, then you might see an error message as shown below:

C:\Users\Arun>telnet localhost 6666
Connecting To localhost...Could not open connection to the host, on
port 6666: Connect failed

This error is more prominent in Windows Vista / 7 because of the Windows User Account Control (UAC). Or anywhere where GlassFish is installed in a directory that require root/administrator/sudo access to read/write. This Tip Of The Day will explain how to workaround this issue.

The default NetBeans installation directory is "C:\Program Files\NetBeans 6.8" and GlassFish goes in "C:\Program Files\sges-v3". At first start of NetBeans (typically as a non-Administrator), it tries to register the pre-configured domain in GlassFish installed in "C:\Program Files". But the non-Adminstrator user do not have read/write access to "C:\Program Files" and any sub-directories. So NetBeans create a new "personal" domain and assign a random port available at that moment for telnet. It shows all the ports assigned during the domain creation as shown below:

The image shows the port number "22007" for OSGI_SHELL.

How do you find that port later ? – Go to "Services" tab, expand "Servers", right-click on "Personal GlassFish v3 Domain", select "Properties" from the popup menu to see the following window:

The "Domains folder" shows the directory location of newly created domain and "Domain Name" has the domain name. The exact assigned port can be found by looking at "Domains folder"\"Domain Name"\config\domain.xml. On my Windows7, it showed the following line:


So I tried "telnet localhost 22007" and voila, it worked!

Some other possible solutions that will work:

  1. Delete ".netbeans" directory and restart NetBeans by right-clicking on selecting "Run as administrator". This will provide the required rights for NetBeans to read/write "C:\Program Files\sges-v3\glassfish\domains\domain1" directory. And so instead of creating a new "personal" domain, it’ll register the existing domain in "\Program Files\sges-v3\glassfish". Then "telnet localhost 6666" will work as expected.
  2. During NetBeans installation, specify GlassFish installation directory in a user directory such as:

    This will ensure that NetBeans will have required privileges to read/write the "domains\domain1" directory.

  3. Delete the "Personal GlassFish v3 Domain" and register a new instance that is already installed in a user directory.
  4. Disable UAC.

A complete archive of all the TOTDs is available here.

Technorati: totd netbeans glassfish v3 felix osgi telnet

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 21, 2010

“Sun Microsystems, 1982 – 2010″ – Farewell by James Gosling

Filed under: General — arungupta @ 2:46 pm

James Gosling is bidding farewell to Sun Microsystems because of the unconditional approval of Oracle’s acquisition by European Commission. Here is fitting artwork from his blog:

After spending close to 11 years at Sun, it’s pretty emotional to read through the entire set of comments on his blog. Consider buying a mug, tee-shirt, cap, tile coaster or mousepad.

But there are many more miles to go …

Technorati: sun oracle rip

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

TOTD #118: Managing OSGi bundles in GlassFish v3 – asadmin, filesystem, telnet console, web browser, REST, osgish

Filed under: General — arungupta @ 4:00 am

GlassFish v3 and OSGi integration is now known for almost two years. Several blogs have been published on this topic and googling on "glassfish osgi" shows 817,000 results. This blog has published four entries on the topic so far.

This Tip Of The Day (TOTD) will show the different ways you can manage OSGi bundles in GlassFish v3.

The first part is to create a trivial OSGi bundle as explained in TOTD #36.

  1. Create a simple Maven project using the command as shown below:
    ~/samples/v3/osgi >mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=org.glassfish.samples.osgi.helloworld -DartifactId=helloworld
    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'archetype'.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Default Project
    [INFO]    task-segment: [archetype:create] (aggregator-style)
    [INFO] ------------------------------------------------------------------------
    [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
    [INFO] Setting property: velocimacro.messages.on => 'false'.
    [INFO] Setting property: resource.loader => 'classpath'.
    [INFO] Setting property: resource.manager.logwhenfound => 'false'.
    [INFO] [archetype:create]
    [WARNING] This goal is deprecated. Please use mvn archetype:generate instead
    [INFO] Defaulting package to group ID: org.glassfish.samples.osgi.helloworld
    [INFO] artifact org.apache.maven.archetypes:maven-archetype-quickstart: checking for updates from central
    [INFO] ----------------------------------------------------------------------------
    [INFO] Using following parameters for creating OldArchetype: maven-archetype-quickstart:RELEASE
    [INFO] ----------------------------------------------------------------------------
    [INFO] Parameter: groupId, Value: org.glassfish.samples.osgi.helloworld
    [INFO] Parameter: packageName, Value: org.glassfish.samples.osgi.helloworld
    [INFO] Parameter: package, Value: org.glassfish.samples.osgi.helloworld
    [INFO] Parameter: artifactId, Value: helloworld
    [INFO] Parameter: basedir, Value: /Users/arungupta/samples/v3/osgi
    [INFO] Parameter: version, Value: 1.0-SNAPSHOT
    [INFO] ********************* End of debug info from resources from generated POM ***********************
    [INFO] OldArchetype created in dir: /Users/arungupta/samples/v3/osgi/helloworld
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 11 seconds
    [INFO] Finished at: Wed Jan 20 14:12:41 PST 2010
    [INFO] Final Memory: 12M/80M
    [INFO] ------------------------------------------------------------------------
  2. Change the generated App class in "src/main/java/org/glassfish/samples/osgi/helloworld" folder so that it looks like:
    package org.glassfish.samples.osgi.helloworld;
    import org.osgi.framework.BundleActivator;
    import org.osgi.framework.BundleContext;
    * Hello world!
    public class App implements BundleActivator {
    public void start(BundleContext context) throws Exception {
    public void stop(BundleContext context) throws Exception {

    This is a trivial Activator class but sitll shows the key methods. The changes are highlighted in bold.

  3. Update "pom.xml" with the following changes:
    1. Change <packaging> to "bundle" from the default value of "jar".
    2. Add <dependency> on "org.osgi.core".
    3. Add the <plugin> maven-bundle-plugin and provide <instructions> to generate the appropriate MANIFEST.MF.
      <project xmlns=""

  4. Generate the OSGi bundle as shown below:
    ~/samples/v3/osgi/helloworld >mvn install
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building helloworld
    [INFO]    task-segment: [install]
    [INFO] ------------------------------------------------------------------------
    [INFO] [resources:resources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:compile]
    [INFO] Compiling 1 source file to /Users/arungupta/samples/v3/osgi/helloworld/target/classes
    [INFO] [resources:testResources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [compiler:testCompile]
    [INFO] Compiling 1 source file to /Users/arungupta/samples/v3/osgi/helloworld/target/test-classes
    [INFO] [surefire:test]
    [INFO] Surefire report directory: /Users/arungupta/samples/v3/osgi/helloworld/target/surefire-reports
    T E S T S
    Running org.glassfish.samples.osgi.helloworld.AppTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
    Results :
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    [INFO] [bundle:bundle]
    [INFO] [install:install]
    [INFO] Installing /Users/arungupta/samples/v3/osgi/helloworld/target/helloworld-1.0-SNAPSHOT.jar to /Users/arungupta/.m2/repository/org/glassfish/samples/osgi/helloworld/helloworld/1.0-SNAPSHOT/helloworld-1.0-SNAPSHOT.jar
    [INFO] [bundle:install]
    [INFO] Parsing file:/Users/arungupta/.m2/repository/repository.xml
    [INFO] Installing org/glassfish/samples/osgi/helloworld/helloworld/1.0-SNAPSHOT/helloworld-1.0-SNAPSHOT.jar
    [INFO] Writing OBR metadata
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 8 seconds
    [INFO] Finished at: Wed Jan 20 14:18:31 PST 2010
    [INFO] Final Memory: 20M/80M
    [INFO] ------------------------------------------------------------------------

    The generated "target/helloworld-1.0-SNAPSHOT.jar" has the following contents:


    And the generated "MANIFEST.MF" looks like:

    Manifest-Version: 1.0
    Export-Package: org.glassfish.samples.osgi.helloworld;uses:="org.osgi.
    Built-By: arungupta
    Tool: Bnd-0.0.357
    Bundle-Name: helloworld
    Created-By: Apache Maven Bundle Plugin
    Bundle-Version: 1.0.0.SNAPSHOT
    Build-Jdk: 1.6.0_17
    Bnd-LastModified: 1264025910352
    Bundle-ManifestVersion: 2
    Bundle-Activator: org.glassfish.samples.osgi.helloworld.App
    Import-Package: org.glassfish.samples.osgi.helloworld,org.osgi.framewo
    Bundle-SymbolicName: helloworld

Lets install this newly created OSGi bundle in GlassFish v3. First, fire up GlassFish as:

~/tools/glassfish/v3/74b/glassfishv3/glassfish >./bin/asadmin start-domain -v
Jan 20, 2010 2:30:39 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
. . .
Jan 20, 2010 2:30:40 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 52 msec.
Jan 20, 2010 2:30:40 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Felix platform
Welcome to Felix
[#|2010-01-20T14:30:49.437-0800|INFO|glassfishv3.0|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=11;_ThreadName=FelixStartLevel;|Perform lazy SSL initialization for the listener 'http-listener-2'|#]
[#|2010-01-20T14:30:49.527-0800|INFO|glassfishv3.0|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=12;_ThreadName=Thread-11;|Starting Grizzly Framework 1.9.18-k - Wed Jan 20 14:30:49 PST 2010|#]
. . .
[#|2010-01-20T14:30:58.668-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart/, felix.fileinstall.debug=1};|Started bundle: file:/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart/org.apache.felix.scr.jar|#]
[#|2010-01-20T14:30:58.786-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart/, felix.fileinstall.debug=1};|Started bundle: file:/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart/osgi-web-container.jar|#]
[#|2010-01-20T14:31:00.436-0800|INFO|glassfishv3.0|null|_ThreadID=23;_ThreadName=ping;|Total number of available updates : 0|#]

There are several ways to manage the OSGi bundles in GlassFish v3:

  1. The "asadmin" command (explained here)
  2. Filesystem operations using the pre-installed Apache Felix File Install bundle (explained here)
  3. A Telnet shell using pre-installed Apache Felix Remote Shell (explained here and TOTD #103)
  4. A Web browser using the Apache Felix Web Console (needs to be installed separately and more details below)
  5. A RESTful client by installing the REST console (need to be installed separately and more details below)

Lets explore each option in detail now.

Option 1: Manage the OSGi bundle using the "asadmin" command

  1. Deploy the generated OSGi bundle using asadmin command:
    ~/samples/v3/osgi/helloworld/target >~/tools/glassfish/v3/74b/glassfishv3/glassfish/bin/asadmin deploy --type osgi helloworld-1.0-SNAPSHOT.jar
    Application deployed successfully with name helloworld-1.0-SNAPSHOT.
    Command deploy executed successfully.

    The server log shows the following output:


    Notice "Hey!" message in the server log as the bundle gets started.

  2. Verify the installed bundle as:
    ~/samples/v3/osgi/helloworld/target >~/tools/glassfish/v3/74b/glassfishv3/glassfish/bin/asadmin list-applications
    Command list-applications executed successfully.

    Or if there are multiple applications deployed then only the OSGi bundles can be queried as:

    ~/samples/v3/osgi/helloworld/target >~/tools/glassfish/v3/74b/glassfishv3/glassfish/bin/asadmin list-applications --type osgi
    Command list-applications executed successfully.
  3. The bundle can be undeployed as:

    ~/samples/v3/osgi/helloworld/target >~/tools/glassfish/v3/74b/glassfishv3/glassfish/bin/asadmin undeploy helloworld-1.0-SNAPSHOT
    Command undeploy executed successfully.

    And then the following message is shown on the console:


    Notice "Bye!" message in second line of the log output indicating the bundle is stopped.

Option 2: Manage the OSGi bundle using file system operations

  1. Copy the generated jar (target/helloworld-1.0-SNAPSHOT.jar) in "modules/autostart" directory as:
    ~/tools/glassfish/v3/74b/glassfishv3/glassfish >cp ~/samples/v3/osgi/helloworld/target/helloworld-1.0-SNAPSHOT.jar modules/autostart/

    and that shows the log output as:

    [#|2010-01-20T16:29:04.625-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish
    /modules/autostart/, felix.fileinstall.debug=1};|Installed /Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart/
    [#|2010-01-20T16:29:04.635-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish
    /modules/autostart/, felix.fileinstall.debug=1};|Hey!|#]
    [#|2010-01-20T16:29:04.636-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish
    /modules/autostart/, felix.fileinstall.debug=1};|Started bundle: file:/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart

    Notice "Hey!" message in the second line of log output as the bundle gets started.

  2. The bundle can be undeployed by removing the JAR file from "modules/autostart" directory as:
    ~/tools/glassfish/v3/74b/glassfishv3/glassfish >rm modules/autostart/helloworld-1.0-SNAPSHOT.jar

    that shows the following output:

    ~/tools/glassfish/v3/74b/glassfishv3/glassfish >[#|2010-01-20T16:32:04.677-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish
    /modules/autostart/, felix.fileinstall.debug=1};|Uninstalling bundle 224 (helloworld)|#]
    [#|2010-01-20T16:32:04.679-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish
    /modules/autostart/, felix.fileinstall.debug=1};|Bye!|#]
    [#|2010-01-20T16:32:04.682-0800|INFO|glassfishv3.0||_ThreadID=21;_ThreadName={felix.fileinstall.poll=5000,, felix.fileinstall.dir=/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish
    /modules/autostart/, felix.fileinstall.debug=1};|Uninstalled /Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart

    Notice "Bye!" message in second line of the log output indicating the bundle is stopped.

Option 3: Manage the OSGi bundle using a remote Telnet Shell

  1. Connecting to the Felix Remote Shell as:
    ~/tools/glassfish/v3/74b/glassfishv3/glassfish >telnet localhost 6666
    Trying ::1...
    telnet: connect to address ::1: Connection refused
    Trying fe80::1...
    telnet: connect to address fe80::1: Connection refused
    Connected to localhost.
    Escape character is '^]'.
    Felix Remote Shell Console:
  2. Install the bundle as:
    -> install file:///Users/arungupta/samples/v3/osgi/helloworld/target/helloworld-1.0-SNAPSHOT.jar
    Bundle ID: 225

    The command output shows "225" as the bundle id. This id is used to start / stop / uninstall the bundle.

  3. Check the bundle status as:
    -> find hello
    ID   State         Level  Name
    [ 225] [Installed  ] [    1] helloworld (1.0.0.SNAPSHOT)

    and then start, stop, and uninstall the bundle as:

    -> start 225
    -> stop 225
    -> uninstall 225
    -> find hello
    No matching bundles found

    which shows following output in the logs:

    [#|2010-01-20T16:43:45.399-0800|INFO|glassfishv3.0||_ThreadID=38; remote=/;|Hey!|#]
    [#|2010-01-20T16:43:58.516-0800|INFO|glassfishv3.0||_ThreadID=38; remote=/;|Bye!|#]

    Notice "Hey!" and "Bye!" messages in the log output as the bundle is started and stopped.

Option 4 – Manage the OSGi bundle using a Web browser

Lets see how the OSGi bundles in GlassFish can be managed using Apache Felix Web Console. This is originally explained in Sahoo’s blog.

  1. Copy GlassFish OSGi HTTP Service bundle from here (latest) and save it in the "modules/autostart" directory.

  2. Copy Apache Felix Web Console bundle from here (latest) and save it in the "modules/autostart" directory.

  3. Ignore the "NoClassDefFoundError" in the server log. The key is to look for the following message in server log:

    Started bundle: file:/Users/arungupta/tools/glassfish/v3/74b/glassfishv3/glassfish/modules/autostart/org.apache.felix.webconsole-2.0.4.jar|#]
  4. Open the URL "http://localhost:8080/osgi/system/console/bundles" in a browser and use "admin" as the username and "admin" as the password as shown below:

    I had to enter the credentials couple of times for the login to work but finally the following window showed up:

    It shows a complete summary of all the OSGi bundles available/installed/active etc in GlassFish v3. A new OSGi bundle can be installed by clicking on "Choose File" button. Several administration commands such as Start/Stop, Update, Uninstall, Refresh Import Packages can be issued for each bundle by clicking on associated buttons.

  5. Install the OSGi bundle by clicking on "Choose File" and selecting "helloworld-1.0.-SNAPSHOT.jar" and then click on "Install or Update" button. The following message is shown in the server log:

    [#|2010-01-20T17:04:46.654-0800|INFO|glassfishv3.0||_ThreadID=39;_ThreadName=Background Install /var/folders/+E/+E6YtSvGGEKNwOA77I-9Fk+++TI/-Tmp-/install1657418488877506078.tmp;

    The bundle gets installed and started as identified by "Hey!" message.
    The recently installed "HelloWorld" bundle looks like:

    Clicking on "helloworld" shows the complete status about the bundle as shown below:


  6. The bundle can be stopped by clicking on the Stopped, Refreshed Package Imports, Updated, and Uninstalled by clicking on the respective buttons in the "Actions" column. Clicking on the Stop button shows the following message:


    Notice "Bye!" message indicating the bundle has stopped.

Option 5: Manage the OSGi bundle using a REST console

  1. If not done already, copy GlassFish OSGi HTTP Service bundle from here (latest) and save it in the "modules/autostart" directory.
  2. Download the REST console bundle (latest) in "modules/autostart" directory.
  3. The complete list of bundles is available in Text or XML format by accessing the URL "http://localhost:8080/osgi/restconsole/bundles/.txt" or "http://localhost:8080/osgi/restconsole/bundles" respectively. Here is how the text output looks like:
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    Dload  Upload   Total   Spent    Left  Speed
    100 16198    0 16198    0     0  1173k      0 --:--:-- --:--:-- --:--:-- 1173kbundles
    . . .
    Generated using Pax-Construct
  4. The OSGi bundle should be installed by issuing the following command:
    curl -X PUT file:///Users/arungupta/samples/v3/osgi/helloworld/target/helloworld-1.0-SNAPSHOT.jar http://localhost:8080/osgi/restconsole/bundles

    but it’s giving a "Segmentation fault". Am following with @fdiotalevi.

    Anyway, the complete usage information of the REST console is described here.

So how do you manage OSGi bundles in GlassFish v3 – asadmin, file system operations, telnet console, web browser, or REST ?

UPDATE: Osgish is a command-line shell for OSGi and implemented in Perl. See the complete installation instructions and it can be used to manage OSGi runtime in GlassFish as well.

A complete archive of all the TOTDs is available here.

Technorati: totd glassfish v3 osgi apache felix bundles maven

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 20, 2010

How to pick a headlamp for night running ? – Petzl, Fenix, Princeton, Black Diamond, …

Filed under: Running — arungupta @ 4:00 am

In order to be prepared for the upcoming TheRelay 2010, I’m planning to start running in the night. This is my first venture into night running and there are several tips to follow (reflective gear, run against traffic, no dark colors, no headphones, etc). One of the most important one is to wear a headlamp that can show the trail sufficiently ahead and keep you aware of any breaks in the sidewalk, a fallen branch, debris or may be even a loose pet.

As with any product, there are several headlamps available in the market and it’s confusing for a first time buyer. There is Moxie, Petzl, Princeton Tec, Petzl, Black Diamond, Fenix and many others. Fortunately has a good variety of them and the beauty is that you can visit your local store and try them on. And as always, the staff is very knowledgeable about the product line and don’t suck you into higher end products which may be an overkill for your adventure. And of course, you can compare the products on, read blog reviews, see product reviews from actual customers, read about them at, tweet about it and get suggestions.

Some of the criteria to keep in mind while making your pick for a headlamp:

  1. Lightweight – It should be lightweight as it’ll be strapped to your head all the time you are running. Any extra weight to your head will be a bothering soon.
  2. Good grip – The lamp should fit nicely on your head and not bounce up & down otherwise it’ll be a pain very soon. Personally, I’d hate to run with holding headlamp in my hands instead.
  3. Brightness – 35-50 lumens is bright enough for night running as it gives you 9-19 seconds of visibility depending upon your pace from (7 – 10 min/mile). See a more detailed table below.
  4. Cost – The headlamps vary from $10 – $500. As with other products, invest wisely depending upon whether this is a one-time gig or you plan to continue this longer term. There are reasonable ones available close to $50.

And then there are several other factors like what kind and how many batteries are required (adds up to total weight), how long before it runs out, Halogen / LED, does it support multiple intensities, waterproof, and rechargeable unit.

Here is a comparison of the short listed headlamps on the features mentioned above:

Features / Models Fenix 7 Petzl Tikka XP 2 Petzl Tikka Plus 2
Weight (with batteries) ?? 3.1 ounces (88 gms) 2.9 oz (82 gms)
Lumens 7 – 225 60 50
Batteries 4 AA 3 AAA 3 AAA
Running time 2.5 – 210 hrs 80-160 hrs 55 – 140 hrs
Range (meters) 120m 17-60m 35m
Intensity 5 (Strobe, SOS, Warning) 2 (Flood/Spot) 2 (Flood only)
Waterproof IPX-8 IPX-4 IPX-4
LED Cree XR-E Q5 1 high-output LED / red LED 1 high-output LED / red LED
Cost 64.95 54.95 33.99
Where to buy ? Amazon Amazon Amazon

After reading forums (here, here, here), product reviews (1, 2), 6 5* reviews @ Amazon, talking to friends, tweeting (1, 2, 3, 4) and getting a strong recommendation from the local REI store, I have decided to purchase Petzl Tikka Plus 2.

Black Diamond Sprinter got good reviews on but there is no point paying additional $40 for the rechargeable unit. I’d rather buy a recharger separately and use it elsewhere as well. Fenix HP10 is similar to Fenix 7, slightly more expensive and no noticeable difference. It’s not worth paying extra money for the lumens that are not required.

Read more about IP waterproof ratings. Basically, IPX-4 provide protection against splashing water and IPX-8 provide protection against continuous immersion beyond 1m.

Here is a table that provides the visibility (in seconds) for a 35m or 50m range headlamp:

Now Amazon has tight restrictions on the usage of pre-paid credit cards and so the payment cannot be split between two of them. All merchants allow such arrangement at least in their physical shop but I guess this is one disadvantage of online shopping.

What headlamp do you use for night running ?

Technorati: running night headlamp petzl fenix therelay gear

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 12, 2010

TOTD #117: Invoke a JAX-WS Web service from a Rails app deployed in GlassFish

Filed under: webservices — arungupta @ 11:24 pm

A user on GlassFish Forum tried invoking a JAX-WS Web service from a Rails application and faced some issues. This Tip Of The Day (TTOD) will discuss the different approaches and shows their current status.

A Rails app can be deployed on GlassFish in 3 different ways:

  1. Directory Deployment in GlassFish v3 Server – TOTD #72 explains how to deploy a trivial Rails application (with just a scaffold) on GlassFish v3 server. Even though the blog uses a Rails application, any Rack-based application can be deployed on the server. This server is also the Reference Implementation for Java EE 6 and can also run Grails and Django applications.
  2. Directory Deployment using light-weight GlassFish Gem – GlassFish Gem is a light-weight version of the full-blown server and is stripped to run, just like the server, any Rack-based application such as Merb, Rails, and Sinatra. TOTD #70 shows how to deploy the same application using GlassFish Gem.
  3. WAR file in GlassFish v2.x or v3 – TOTD #73 explains how to deploy a Rails application as WAR file on GlassFish v2. The JNDI connection pooling part of the blog may be skipped to simplify the steps but the concepts are still valid. TOTD #44 shows how to do JNDI connection pooling for GlassFish v3. As GlassFish v2 has in-built support for session replication, TOTD #92 demonstrate how Rails application can leverage that functionality.

Now lets get to the issue reported by the user using these 3 deployment models.

First, lets deploy a simple Web service endpoint and generate a JAR file of the client-side artifacts:

  1. This blog will use a simple Web service as defined in screencast #ws7. The Web service endpoint looks like:
    package server;
    import javax.jws.WebService;
    * @author arungupta
    public class HelloService {
    public String sayHello(String name) {
    return "Hello " + name;

  2. Generate Web service client-side artifacts as:
    ~/samples/v3/rails/webservice/tmp >wsimport -keep http://localhost:8080/HelloWebService/HelloServiceService?wsdl
    parsing WSDL...
    generating code...
    compiling code...
  3. Create a Web service client jar file as:
    jar cvf wsclient.jar ./server

Now lets write a Rails application and invoke this Web service:

  1. Create a simple Rails application as:
    jruby -S rails webservice

    Optionally you may specify "-d mysql" to use MySQL database. Or better un-comment the following line:

    # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

    in "config/environment.rb" as no database interaction is required.

  2. Create a controller and view as:
    jruby script/generate controller home index
  3. Update the Controller in "app/controllers/home_controller.rb" as:
    include Java
    class HomeController < ApplicationController
    def index
    service =
    port = service.getHelloServicePort
    @result = port.sayHello("Duke")
  4. Change the View in "app/views/home/index.html.erb" as:
    <p>Find me in app/views/home/index.html.erb</p>
    <%= @result %>

Now lets deploy this Web service using the 3 different deployment models mentioned above.

GlassFish v3 allows a directory-based deployment of Rails applications. This application needs to locate the Web service client classes. The "wsclient.jar" can be copied to the "lib" directory of Rails application ("webservice/lib" in our case), "domains/domain1/lib/ext" or "JRUBY_HOME/lib". The library can also be passed during deployment using "–libraries" switch. None of this approach seem to work correctly as explained in issue# 11408. So for now, invoking a JAX-WS Web service from a Rails application deployed directly on GlassFish v3 is not possible, at least until the bug is fixed.

In order to deploy the same application using GlassFish Gem, you can copy "wsclient.jar" to the "lib" directory of your Rails application. And also add the following line to "app/controllers/home_controller.rb":

require 'lib/wsclient.jar'

Alternatively you can copy it to "JRUBY_HOME/lib" directory if this Web service client is accessed my multiple applications. In this case there is no need to add any "require" statement to your Controller. Anyway, running the application as:

jruby -S glassfish

and accessing "http://localhost:3000/home/index" shows the following output:

And finally as explained in TOTD #73, bundle up your original Rails application as WAR and then deploy on GlassFish v3 as:

asadmin deploy webservice.war

Make sure to copy "wsclient.jar" to the "lib" directory of your Rails application and then Warbler will copy it to "WEB-INF/lib" of the generated WAR file. The output is shown as below:

So if you want to invoke a Metro/JAX-WS Web service from a Rails application, then run your Rails application using GlassFish Gem or deploying as a WAR file. It’ll work on GlassFish v3 server when issue# 11408 is fixed.

Here are some additional links:

  • TOTD #104 also shows how popular Rails applications such as Redmine, Typo, and Substruct can be easily deployed on GlassFish.
  • Rails applications can be easily clustered using Apache + mod_proxy or  nginx.

A complete archive of all the TOTDs is available here.

Technorati: totd glassfish v3 jruby rails webservice jax-ws metro

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 5, 2010

2009 Running Summary – 1286 miles, 71% of running days

Filed under: General — arungupta @ 4:31 am

Here is a summary of my running logs in 2009:

And a bar chart that shows mileage for each day:

And finally a summary for each quarter:

Quarter Summary
Jan 1 – Mar 31, 2009
Apr 1 – Jun 30, 2009
Jul 1 – Sep 30, 2009
Oct 1 – Dec 31, 2009

The last quarter was just terrible in terms of number of running days and pace but was a good recovery period as well. However I can certainly feel it in terms of the overall reduced pace. The biggest reasons for missed out running in 2009 were falling sick or traveling with no gym facility in the hotel.

Two goals for 2010:

  • Reduce the number of missed days of running – With no upcoming travel plans, this might be a good time to catch up on this goal.
  • Increase the overall mileage – This will require more than a few long distance runs and so will try to get them early on.

The charts shown above can be easily generated using using a Rails application or a Wicket application on GlassFish.

Technorati: glassfish running logs 2009

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 4, 2010

FREE Java EE 6 1-week online Codecamp – Jan 12th, 2010

Filed under: General — arungupta @ 11:20 am

Happy New Year!

Java EE 6, GlassFish v3, and NetBeans 6.8 were released last month. Are you interested in learning how this awesome combination of technologies and products make your life simpler ? Do you want to brush up your skill set and learn to write Java EE 6 code using NetBeans 6.8 and GlassFish v3 ? Would you like to learn  tips & techniques from the experts in GlassFish community ? Do you want to start 2010 with a complete immersion in Java EE 6 & GlassFish v3 ?

If answer to any of the above questions is "yes", then you should consider attending the upcoming free Java EE 6 online code camp. You are certainly welcome to attend the sessions otherwise as well :-)

The goal of this code camp is to let you write code, lots of code, exercising key Java EE 6 technologies.

The sessions are distributed over multiple days (schedule subject to change) as shown below:

Topics Date/Day
Getting Java EE 6 sample codes Jan 12th, 2010 (Tuesday)
Servlet 3.0 Jan 12th, 2010 (Tuesday)
Context and Dependency Injection (JSR 299) Jan 13th, 2010 (Wednesday)
JPA 2.0 Jan 14th, 2010 (Thursday)
EJB 3.1 Jan 15th, 2010 (Friday)
JSF 2.0 Jan 18th, 2010 (Monday)
Java EE 6 End-to-end Examples Jan 19th, 2010 (Tuesday)
GlassFish v3 Jan 20th, 2010 (Wednesday)

Here is what you need to do before attending the hands-on lab session:

  1. Watch the corresponding video-taped sessions from Java EE 6 & GlassFish v3 Virtual Conference.
  2. Send an email to to register for the course. All discussions can be seen from the web-based forum.
  3. Download & Install JDK 6.0. (1.6.0_017+ for Operating Systems other than MacOS, 1.6.0_015+ for MacOS)
  4. Download & Install NetBeans 6.8 with GlassFish v3 ("Java" or "All" bundle)

If you finish the homework from each lab, yeah there is optional homework ;-) , then you’ll also be awarded a certificate of completion.

So strap your seat belts and get ready for the Java EE 6 hands-on journey next week!

Always check Java EE 6 Online Codecamp for latest updates.

Technorati: conf glassfish v3 javaee handson lab

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress