vendredi octobre 03, 2008
|
Bundling GlassFish v3 Prelude - XWiki and the GlassFish Embedded (Part 2) In Part I, I covered a first technique to bundle the XWiki application with GlassFish v3 Prelude. The distribution and packaging discussed included a "traditional" auto-deployment of a web application (WAR) in a lightweight application server (GlassFish v3 Prelude). GlassFish Embedded APIXWiki is a non-trivial application and I felt it would be a great test for the GlassFish Embedded API. This enables GlassFish to run in-process as explained in the rest of this entry. While the embedded API can be very useful for testing (it can now already be used with Maven and Grails for instance), the goal here is to produce a self-container Java SE application which contains GlassFish Embedded, the XWiki WAR archive and some glue code to start glassfish and deploy the application Putting the pieces together
GlassFish Embedded does not use OSGi but rather a more traditional class-loader hierarchy so I had to work around a "classical" JAR precedence issue:
Using the GlassFish Embedded API is pretty straightforward :
import org.glassfish.embed.App;
import org.glassfish.embed.AppServer;
public class XWikiOnGlassFish {
public static void main(String[] args) throws IOException {
AppServer glassfish = new AppServer(8080);
App app = glassfish.deploy( new File("/path/to/xwiki-enterprise-web-1.5.2.war") );
}
}
Results
The application weights 20 MB for the full GFv3 Prelude embedded (see other distributions here) + 4Ko "glue" application + 40MB XWiki.
The startup time is as follows:
I'll leave the packaging of this Java SE application (see what the OpenSSO guys did) using Java Web Start as an exercice to the reader. More coverage of the GlassFish Embedded API (including the Bundling GlassFish v3 Prelude - XWiki (Part 1) In previous blog posts about XWiki and GlassFish, I explained how to expose XWiki on the GlassFish v2 update center and how to deploy XWiki in a GlassFish container. Recent XWiki and GlassFish evolution.This was a while back and XWiki, now a GlassFish partner, has nicely moved forward to version 1.5.2 (Stable). At the same time GlassFish released an embedded API and will soon ship GlassFish v3 Prelude, a lightweight container. Shipping XWiki and GlassFish v3 Prelude together actually makes sense. The download is much smaller (21MB) than it would have been with GlassFish v2 (65MB), but having now an embedded API for the GlassFish makes it a reasonable Jetty alternative. It can for instance be used to implement an evaluation bundle (similar to what the OpenSSO folks did: 85Mb, Java Web Start deployment included). Simple XWiki and GlassFish packaging.
Using JavaDB this time (no need to add driver in XWiki's
Using GlassFish v3 Prelude promoted build #25 (Sept 19th), I could easily deploy by copying the archive in the auto-deploy directory (
This can lead to a simple ZIP archive with GlassFish v3 + XWiki 1.5.2 war sitting in the auto-deploy directory. Make sure also that you nuke the The next step is to start using the GlassFish embedded API. Thanks to XWiki CTO Vincent Massol for the quick turnaround answering my questions and bug reports. ( sept. 26 2008, 05:48:08 PM CEST ) Permalink
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
The user experience then looks like this :
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. Interested in packaging your application for the GlassFish Update Center? Try this out and post comments here! ( oct. 22 2007, 11:02:00 AM CEST ) Permalink Comments [3]
XWiki meets GlassFish v2 |