Friday Aug 14, 2009

VisualVM OSGi plugin with GlassFish v3


The Java VisualVM blogging contest results are in and the "VisualVM OSGi plugin" entry clearly caught my eye. Not simply because it's in the top three, but because this management of OSGi platforms via JMX in a tool shipping with the JDK (visualvm) works well with GlassFish v3.

You'll find the documentation and downloads on the creator's page. Kiev Gama also documents how he built the plugin (a NetBeans plugin really) for visualvm in this blog entry.

This is a nice addition to the ability to use the Felix shell (telnet localhost 6666) and to the Felix web console. All tools let you observe the content and status of the 200+ OSGi bundles currently in GlassFish v3 as well as operate on their life-cycle. This visualvm plugin matches well the troubleshooting positioning of visualvm (you most likely don't need it for day-to-day development). Of course, this is not specific to GlassFish and Kiev mentions having tested this with Fuji.

Kiev Gama was born in Recife, Brazil and is a PhD Student in Computer Science at UJF-Grenoble, France. Not really a surprise when you know that Richard Hall (of Felix fame and now with the GlassFish Team) used to be part of that group.

Friday Jul 24, 2009

Overview of OSGi Support in GlassFish v3


This is a short overview of how GlassFish v3 provides support for OSGi through pointers to the work / posts of Richard, Sahoo, Jerome and many others.

The story starts with an OSGi-core that is used in a system that is organized around the notions of a kernel, services and components. A good overview is Jerome's presentation at JavaOne, TS-4923.

For the basic deployment check Jerome's GFv3 Extensions: Managed OSGi bundles which explains how asadmin deploy --type=osgi myosgibundle.jar will deploy an OSGi bundle: GFv3 installs the bundle in the OSGi framework, starts it and also records the information in domain.xml, so asadmin list-components will show that an OSGi bundle has been deployed. Note you can then Use the Felix Web Console to browse through the OSGi bundles.

There are other ways to activate the same deployment machinery and, in Using filesystem operations to manage OSGi bundles in GlassFish, Sahoo shows how GFv3 leverages Apache Felix's FileInstall to allow autodeploy via the autodeploy-bundles/ directory.

Jerome's next two posts describe an extension in GF v3 that allows applications to use @Resource to refer to OSGi services. In the first one, GF v3 Extensions: Spring, Java EE 6 and OSGi, the service is a Spring Bean that is exposed to the OSGi service registry using Spring DM, while in GF v3 Extensions: OSGi Declarative Services he just uses the standard OSGi Declarative Services, which were made part of the standard GF v3 bundle starting with b55

More posts in a future installment...