vendredi août 21, 2009

Updating GlassFish v3 Preview to a more recent promoted build

This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

GlassFish v3 Preview is build #47(d) and came out right before JavaOne (May 2009). On the way to v3 final, the team is releasing promoted builds every week. We're now down to build 60, so you can imagine how much has changed and what you're missing out on if you're still on build 47. of course you can download the promoted build and re-install GlassFish, but this entry is all about using the IPS package management tools that ship with GlassFish v3 (in the top-level glassfish bin/ directory) to upgrade an existing install.

If you don't mind living on the bleeding edge (promoted builds are less stable than the "Preview" release by definition) you can change your default authority (IPS repository) from a one (whose content hasn't changed since May) to a authority which hosts promoted builds :

% pkg set-authority --enable -P -O

This defines a new authority as the preferred (-P) source for GlassFish packages.
Optionally you can also disable the stable authority :

% pkg set-authority --disable

In any case, updating to the latest promoted build is a simple as issuing this command (or using the updatetool UI) :

% pkg image-update

If you were to set back to being the preferred repository, that would not roll you back to build 47d (v3 Preview) but it would stop offering you to update every week to the newly promoted build. Finally, note that you cannot disable a preferred authority and that to list all authorities, including those that are disabled, you'll need to use the "pkg -a publisher" command.

mardi avr. 14, 2009

Sample Hibernate Community Package for GlassFish v3

This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

This is the second of a series of entries for people interested in producing packages for GlassFish v3 and hosting them on a live repository. The previous entry is IPS/pkg(5) crash-course for GlassFish v3 community package developers - Part 1. The next entry is here: Different strategies for building different packages (for GlassFish v3).

In this entry, we'll go through the various parts required to make the Hibernate library available to end-users via the GlassFish v3 Update Center. This enables developers to add this library with a single step, thus avoiding various well-known jar/classloader issues. In a team of multiple developers, all can install the library in the same manner. This provisioning/install approach can be extended beyond the simple use of a library, but let's start with something simple (more in other entries).

As introduced in the previous entry the glassfish-repo project is where it all happens. It provides a bootstrapping mechanism to abstract away the low-level details of creating and publishing IPS packages. Looking at the code hosted on glassfish-repo, you'll find a top-level directory called packager/ which has sub-directories, each corresponding to an IPS package for GlassFish v3.

There's a bit of setup described here for the following:
Update Center 2.x toolkit image. This is the cross-platform bootstrap code needed for creating, publishing, installing, and installing IPS packages. Get it from You will need to add pkg/bin and pkg/python2.4-minimal/bin to your PATH
and pkg/python2.4-minimal/lib and pkg/vendor-packages to LD_LIBRARY_PATH. You will not manipulate this toolkit yourself, a Maven plugin will do it for you.
Subversion (to check out the project code). This is not needed if you create your own local directory structure and don't intend to publish back to this glassfish-repo project (although we'd love for you to share as much as you possibly can).
Maven 2.0.9 (everything is built using Maven2 in GlassFish v3 btw).

Key files and directories
There are really three key files and a directory for building an IPS package (this is documented here, so inlining it here for brevity) :
packager/package-name/pom.xml, the Maven config file to describe any dependency used when building the IPS package and the Maven profile/plugin that does all the packaging magic for you.
packager/package-name/build.xml, the ANT script that lays out the files on disk as they should be installed on the target GlassFish instance.
packager/package-name/src/main/resources/ is called the prototype file and it contains the metadata required to build the package (name, version, license, and various attributes). The file format is well-documented here.
packager/package-name/target/stage is the staging area where the above ANT script should layout the files (with proper permissions) required by the IPS package. This is the root of a glassfish v3 install.

Before looking at the Hibernate example, consider studying packager/sample-package and using it as a template for your own packages.

Authoring the Hibernate IPS package example
The Hibernate package artifacts available from the glassfish-repo project has the following interesting content (click on the filenames to see the entire content):

packager/package-name/pom.xml contains the existing Maven profile and plugin definition encapsulating the IPS logic and adds a dependency to the hibernate-ips artifact (version hosted on the Maven2 repository :

packager/package-name/build.xml simply creates the target/stage directory and places the various libraries required by Hibernate into the lib/ directory, thus making the framework available to all the applications deployed in a domain or instance related to the GlassFish install for which users will be installing this package. Check this link for how to best use the "Common Class Loader" and decide where you need to place your jar files. Optionally you can use the <attachArtifact> tag to create an .ipstgz file (also discussed here) to archive the work done by this script.

packager/package-name/src/main/resources/ contains pretty self-explanatory metadata for the IPS package (name, version, summary, description, and classification). In particular this is where you reference the location of the LICENSE.txt file (name and location can be different). dirtrees offers a way to take a subset of what is in the staging area by explicitly listing the directories that should be considered as being part of the IPS package. More documentation on the format of the file can be found here. Most of this is presented to the user when listing or installing the package. There is no dependency specified for this package. If you are not familiar with the Python syntax, I would suggest you look at IDE's (such as NetBeans) offering Python support (color-syntaxing, etc...) to avoid debugging issues late in the build process.

packager/package-name/target/stage contains a single "glassfish" subdirectory that corresponds to the top-level directory in a GlassFish v3 prelude install and all the Hibernate JAR files are placed into the lib/ directory of the appserver install. This translates into having them placed in GLASSFISH_V3_INSTALL/glassfish/lib. Note that you shouldn't assume the presence of any particular domain such as "domain1" (more on that in another post).

Publishing and testing
Building and publishing is really a single-step process with IPS so you need to start a local repository using:
$ pkg.depotd -d ips-toolkit-dir/pkg -p 10000 --rebuild (running on part 10000. Full documentation here.

At that point, you can simply invoke maven from the package directory root (packager/hibernate in our case) with the appropriate repository URL, the path to the python binary, and the "ips" profile name :
$ mvn -Drepo.url=http://localhost:10000 -Dpython=ips-toolkit-dir/pkg/python2.4-minimal/bin/python -P ips

Once the package is successfully packaged, you can use GlassFish's Update Tool (GF_V3_INSTALL/bin/updatetool) or the pkg CLI to :
• add http://localhost:10000 as an additional repository
• test the package

Another post will soon cover how packages can make their way on to the "live" repository.

If you're interested in the maven-makepkgs-plugin logic/magic used build the IPS on your behalf, read the project's main page, and this post by Kohsuke. You'll find out how to build a package with a single src/ file (no ANT) and getting most of it's metadata straight from Maven.

Going further...
Upcoming entries will covers the process to actually publish your packages to the GlassFish repository. This entry covers Different strategies for building different packages (for GlassFish v3). Expect also more entries on building more advanced packages.

lundi avr. 06, 2009

IPS/pkg(5) crash-course for GlassFish v3 community package developers - Part 1

This blog has moved to
Follow the link for the most up-to-date version of this blog entry.

This is the first of a series of entries for people interested in producing packages for GlassFish v3 and hosting them on a live repository. Part 2 describing the Hibernate package is here. Part 3 discussing different strategies for building different packages is there.

GlassFish v3 (starting with the "Prelude" release from last Fall) uses IPS, aka pkg(5), to manage the various bits and pieces (modules or packages) of the application server. IPS stands for Image Packaging System and comes from the OpenSolaris land and gives GlassFish v3 a graphical (bin/updatetool) and CLI (bin/pkg) tools to manage packages, those that come with GlassFish and the ones available from IPS repositories. The new web admin console also integrates an IPS client. These tools let you browse, install, update, and remove packages very similar to Synaptic/apt, Eclipse, or NetBeans (note that this is different from the technology used for the update center in GlassFish v2). This "Getting Started" is a great intro to using the Update Center.

If you're interested in IPS, there's a bunch of resources around IPS and this IPS primer by Kohsuke is one such good resource for a pragmatic view and tools such as makepkgs, and recommandations for testing packages and moving them around. This current blog entry focuses on the GlassFish perspective and in particular for people interested in creating they're own packages to add features or applications to GlassFish. In the case of GlassFish v3 Prelude, existing packages are listed directly on the various repositories:
"% bin/pkg authority" lists registered repositories while "% bin/updatetool" provides an equivalent but graphical view.

There are potentially really different sorts of packages that can be installed via IPS and the GlassFish Update Center: frameworks, Java EE applications, standalone applications, and GlassFish extensions. Future blogs will go into each of those but, in a nutshell, it's all about laying out files on disk and adding some extra metadata to the package itself (name, license, etc...).

IPS is also used throughout the middleware organization at Sun to deliver its software and is the project that defines a portable (not just OpenSolaris) environment and tools to make this happen. In particular, you will most likely need a pre-installed Toolkit Image specific to the platform used for producing the packages (IPS is written in Python and this toolkit contains the pkg binary, a minimal Python 1.4 runtime, and a number of Java APIs).

The first thing you probably need to know is that is the place to start to avoid having to understand the intricacies of IPS. This is where you will be asked to provide :
• your artifacts (the actual files or a Maven dependency expressed in pom.xml)
• license and readme files
• a simple python file containing additional meta-data: version, description, dependencies, and more
• a build.xml ANT script laying out the bits in a staging area

My next entry in this series walks through the existing "hibernate" package available in source format on glassfish-repo and already live in the contrib GlassFish v3 Prelude repository.

samedi févr. 21, 2009

IceFaces one step closer to GlassFish Users

IceFaces Push Server and several samples are the latest addition the the GlassFish AppStore Update Center. See Ted's blog for more.
This is available today for GlassFish v2 users. Simply run GLASSFISH_HOME/updatecenter/bin/updatetool and follow the instructions.

Note there's also a recent (Feb 13th) Jersey 1.0.2 update available there.

mercredi févr. 06, 2008

Woodstock from the GlassFish Update Center

Woodstock is a GlassFish sub-project providing a set of nice JSF components used throughout Sun web admin consoles (like the GlassFish Web Console). It's easily available from the NetBeans JSF palette. Some components are AJAX-enabled and all components are theme-able.

To get a feel for what's available from your local GlassFish v2 install, simply go to the update center (GLASSFISH_HOME/updatecenter/bin/updatetool) and install Woodstock 4.1. This will place a sample web application available from the "/example" web context in domain1. Most likely from http://localhost:8080/example/start.jsp

Here are a few components :

mardi nov. 13, 2007

Update Center interview on the GlassFish Podcast is out

I've previously discussed various aspects of the GlassFish Update Center.
You can now listen to the project lead in this new GlassFish podcast interview.

lundi oct. 22, 2007

Using the GlassFish Update Center to reach out to thousands of developers

The GlassFish Update Center is a tool that lets you deploy extra features, libraries, or even applications to an existing installation in a very user-friendly fashion. It is part of every copy of GlassFish, Sun Java System Application Server and the Java EE 5 SDK (3.5M+ downloads). The following describes the simplest GlassFish Update Center module who's only job is to deploy a self-contained web application (no database dependency in particular).

To follow-up on a previous post, I'll use XWiki which has since hit version 1.0 with 1.1.1 being the latest. I've tweaked their WAR distribution to use HSQL (as already described in the previous post) so that it has no dependency on external resources. Making this XWiki distribution available via the GlassFish Update Center requires 2 easy steps:

1/ Package the WAR artifact into a module file (default extension is .nbm but anything can be used as it is really only a ZIP file) with info/info.xml and module/xwiki.war as the only two entries. I've actually called the file xwiki.gfz for no particular reason and posted it here.

2/ Author an Update Center catalog file compliant with this DTD describing the module - download size, module author, license, short/long description, etc... This XML file is the only server-side component needed. I've created and posted the file here (so you can try it). The key line here is :
which basically tells the update center that the module is a Java EE artifact (WAR, EAR, RAR) which will cause the updater to copy it to GlassFish's autodeploy directory. Other valid values for Module-Type are ADDON_INSTALLER, ADDON_CONFIGURATOR, and ARCHIVE.

The user experience then looks like this :
•  Start the Update Center client located in GLASSFISH_INSTALL/updatecenter/bin.
•  Add an Update Center definition in the "Preferences" tab using this URL -
•  Install the update after agreeing to the license (download, unpack and install all happens under the cover)
•  Launch the application (no restart)

Steps are illustrated on this other page

This is an easy way for the many web applications out there to be easily made available to the large number of people downloading GlassFish. Of course not every application is self-contained like the one I used and in that case you would have to use a custom installer and configurator as explained by Manveen here and here. It allows for the Update Center to install bits (libraries, config files, ...), modify existing file (i.e. domain.xml) and create the appropriate resources in the application server (connection pools for instance).

Interested in packaging your application for the GlassFish Update Center? Try this out and post comments here!

mercredi sept. 19, 2007

GlassFish Update Center - what's available (Jersey, Roller, JRubyOnRails, Phobos)

No, GlassFish is not an IDE, but yes GlassFish v2 has an update center (start it using the binary in GLASSFISH/updatecenter/bin).

While it only had a few updates to GlassFish and additional documentation for a while, with the release of GlassFish v2, we're starting to see a whole set of additional features available through this delivery mechanism:
•  Jersey (JAX-RS implementation)
•  JRubyOnRails (using Goldspike)
•  Phobos for server-side scripting with Rhino 1.6R7 (includes E4X)
•  The Roller Blogging Server (the software powering Try this page (short slideshow of screen captures) to get a feel for how easy the process has become, from install to first blog post. Update: Dave has some additional remarks.

Make sure you also check out how to setup your own update center and write your own updates.

mercredi avr. 18, 2007

Nimbus for the GlassFish Update Center?

There's a lot happening in both the server and the clients Java camps. Of course JSR 295 and 296 are the most exciting, but in the community space, I find the work on the Nimbus Look-and-Feel (which I am kinda already using every day since it's based on the Solaris Gnome theme) sounds very exciting.

Of course I could use this new Nimbus look and feel and apply it to NetBeans (the -ui option makes that trivial and I'm still not sure why this is not a standard JVM/Swing option just yet), but I'll let Roman and friends do that. It's probably not yet well known, but GF now has an Update Center as part of v2. It's a separate application from the admin UI and it is Swing-based. Here's what it looks like:

Unfortunately, after some hacking do change the look and feel, the first very good impression I initially got from using SwingSet with Nimbus didn't translate to GlassFish's update center:

Exception in thread "main" java.lang.NullPointerException
       at javax.swing.JTable.setSelectionBackground(
       at javax.swing.plaf.synth.SynthTableUI.updateStyle(
       at javax.swing.plaf.synth.SynthTableUI.installDefaults(
       at javax.swing.plaf.basic.BasicTableUI.installUI(
       at javax.swing.JComponent.setUI(
       at javax.swing.JTable.setUI(
       at javax.swing.JTable.updateUI(
       at javax.swing.JTable.(
I'll keep looking...

In the mean time, the GlassFish Update Center is a tool for making documentation, product updates, extensions and even partner software available to the entire GlassFish user community. This is only the beginning.


This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected


« juillet 2016

No bookmarks in folder


No bookmarks in folder