vendredi oct. 03, 2008

Bundling GlassFish v3 Prelude - XWiki and the GlassFish Embedded (Part 2)

Update: things have changed quite bit since I wrote this for v3 Prelude (now v3 Final is the way to go).
Please check this link for up-to-date info on GlassFish Embedded.


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 API

XWiki 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:
• removed the log4j jar from the XWiki application and make it available as a library (appropriate Class-Path: entry in the manifest of the overall JAR).
• used <class-loader delegate="false"/> in sun-web.xml to avoid further library conflicts (documented here)

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:

with an additional 12 seconds to load the XWiki web app. The memory consumed (used heap as reported by VisualVM) is 15 MB right after the welcome page is displayed and 35 MB after exercising the application a bit.

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 ScatteredWar API, and the Maven integration) can be found here. Note that a few API changes happened since that post.

mardi nov. 06, 2007

dev.viamichelin.com

J'ai suffisamment râlé sur ce blog sur le silence assourdissant des acteurs majeurs français quand il s'agit de publier des API publiques pour les développeurs. J'ai même mentionné ViaMichelin parmi les sites qui passaient à coté de belles opportunités.

Je me dois donc de mentionner le site ViaMichelin pour développeurs. En fait il semble assez ancien, mais je ne le découvre que maintenant dans cet interview. Parmi les choses proposée: ViaMichelin Web Services avec une interface SOAP. De quoi tester GlassFish et ses Web Services Metro/JAXWS me direz vous (apparemment c'est du Axis coté serveur)? Et bien manque de bol, c'est du RPC/Encoded (preuve que ça ne date pas d'hier) et donc pas conforme au WS-I Basic Profile(!). Dommage, Geocoding, ReverseGeocoding, FindPOI, RouteCalculation, DistanceCalculation, MapManagement, Authentication, ça me plaisait bien sur le papier... Nul doute que ça changera dans le futur, à moins que tout évolue vers un API RESTful (le temps que JAX-RS (JSR 311) soit mûr peut-être!).

Ensuite, il y a le Map and Drive API (sujet de l'interview) qui est intégralement en JavaScript. Ce qui me semble intéressant là c'est la possibilité d'exporter le résultat dans un format lisible par un GPS bien réel. Pour le reste, j'ai toujours pas très envie de faire du JavaScript... Peut-être une série de widgets ViaMichelin pour jMaki Ludo? ;)

About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today
Blogroll

No bookmarks in folder

News

No bookmarks in folder