Bistro!
Alexis Moussine-Pouchkine's Weblog
public enum Topic { Java, GlassFish, Tools, Sun, InFrenchInZeText, SDPY }

20091031 samedi octobre 31, 2009

Bug hunting and FishCAT'ing

If anything, the traffic on the "issues" GlassFish mailing list should be a hint on the stabilization work going on before v3 is declared final later this year.

At the same time the FishCAT team is also busy testing the latest releases.

( oct. 31 2009, 11:29:33 PM CET ) Permalink Comments [1]

20091028 mercredi octobre 28, 2009

Oracle's take on GlassFish

On don't think this will quite stop people from asking (me and others on the team) the same question, but this new FAQ from Oracle certainly has some positive information on GlassFish's future. The blogosphere and twitosphere have been quite active on that news today...

( oct. 28 2009, 11:55:28 PM CET ) Permalink Comments [2]

20091007 mercredi octobre 07, 2009

Recent GlassFish endorsements

Servlet 3.0 (JSR 315) support in Maia
How to install and use JRebel with Glassfish and Eclipse IDE
ColdFusion - Installation, deployment, and platforms
New Java-monitor probe for Glassfish users.
I think I also saw something recently on either EHCache or TerraCotta as well...

( oct. 07 2009, 03:20:06 PM CEST ) Permalink Comments [0]

Attending and presenting at Java2Days this week in Sofia

I'll be attending the Java2Days conference at the end of this week in Sofia, Bulgaria.

The conference is quite geared towards server-side Java with Spring and Java EE getting great coverage with SpringSource employees and Java EE expert group member Reza Rahman.

My first talk on Thursday is on GlassFish v3 while the second is on portability of J2EE/JavaEE applications (lessons learned while migrating customer applications to GlassFish). Should be fun!

( oct. 07 2009, 10:13:50 AM CEST ) Permalink Comments [0]

20091005 lundi octobre 05, 2009

Using the EJBContainer API with or without Maven (but with GlassFish v3)

Updated this blog on October 28th as you no longer need to have a full GlassFish install to test EJBs
The typical way to start GlassFish is to use $asadmin start-domain but you could also start it using java -jar modules/glassfish.jar. Both start a standalone instance of GlassFish. The following paragraphs discuss GlassFish Embedded (i.e. start it using an API).

There are at least two ways to start GlassFish in embedded mode: using org.glassfish.api.embedded.Server and associated classes but also using the (now standard in EJB 3.1) EJBContainer.createEJBContainer() API. Let me describe here the latter one and reserve the more general embedded case for a later blog entry.

The goal is to write something like as simple as this to test your EJB :

    EJBContainer c = EJBContainer.createEJBContainer(); // new in EJB 3.1!
    Context ic = c.getContext();
    SimpleEjb ejb = (SimpleEjb) ic.lookup("java:global/sample/SimpleEjb");
    ejb.sayHello();

EJB's found in the classpath of the running code above will automatically be deployed and made available via lookups.

Calls to EJBContainer.createEJBContainer() are likely to be made from your tests. If you're making those calls by constructing yourself the execution classpath, then you simply need to add glassfish/lib/embedded/glassfish-embedded-static-shell.jar, an empty jar with a Class-Path: listing the required jars and that is part of the GlassFish distro. In fact, if you're using recent builds of NetBeans 6.8 (and the soon-to-be-released beta), the IDE does this for you when GlassFish is the target server. If you are using Maven, it's a bit trickier.

To use EJBContainer.createEJBContainer() from Maven tests, you'll need to add the following dependency to your POM (updated to promoted b70):

     <groupId>org.glassfish.extras</groupId>
     <artifactId>glassfish-embedded-all</artifactId>
     <version>3.0-b70</version>
     <scope>test</scope>

You could restrict this to a smaller set of GlassFish artifacts but for non-trivial tests (if you use JPA for instance), you would start to have a fairly long list of dependencies so the above sounds like a reasonable thing to do. This will require Maven to download the GlassFish All-in-one JAR file (40MB or so). The reason I wrote it would be trickier with maven is that you need to pass a property during the createEJBContainer() call indicating the location of a GlassFish v3 install. The above Java code would need to read something like this:

     Map p = new HashMap();
     p.put ("org.glassfish.ejb.embedded.glassfish.installation.root",
           "/path/to/glassfish"); // include trailing "/glassfish"
     ec = EJBContainer.createEJBContainer(p);

As of build 69 (maybe 70?), this is no longer needed - i.e. you can simply have glassfish-embedded-all.jar as a dependency or simply in your classpath. A full install of GlassFish is no longer required (although it may be interesting if you want to use JDBC configurations). Read this blog by Thomas for another interesting approach: Nice follow-up blog here: http://ctpjava.blogspot.com/2009/10/unit-testing-ejbs-and-jpa-with.html

Starting the appserver this way (with or without Maven) exercises the actual GlassFish code, not another implementation or a customized fork. There are some limitations to what you can run and in particular port configuration is ignored (not listening on any) and only local EJB interfaces are available (the spec only requires EJB 3.1 lite support). On the other hand, JPA calls are very much possible.

This should all work with v3 promoted build 66 (I just tested this with promoted build 70, see above simplification). Adam Bien beat me to covering that topic, but I hope you get some additional info here. In my case the start-up, setup, deploy and shutdown of GlassFish Embedded are worth about 6 seconds. Note that there is no OSGi involved here.

For a complete working example with JPA calls, check out this sample code.
The EJB 3.1 specification has a chapter (#22) on "Embeddable Usage". Check it out for further details about EJBContainer.

( oct. 05 2009, 05:40:10 PM CEST ) Permalink Comments [5]

20090918 vendredi septembre 18, 2009

GlassFish tip: customize directory listings

With GlassFish being a very capable HTTP server out of the bowser (thank you Grizzly!), it was time for v3 to offer the ability to configure directory listings. It is now possible to have pages listing files per NAME (default), SIZE, or LAST_MODIFIED.

Configuration can be done inside web.xml (in the form of an additional init-param to the DefaultServlet servlet called sortedBy). This would hold true for a given application and support dynamic reloading (no full redeploy, no restart to take changes into account).

You might find it more convenient to have it be part of default-web.xml (located in domains/domain1/config/). Of course that would require restarting the container. In both cases, the listing should be explicitly allowed or else the user will see a 404 Not Found error. Here's an example to configure the listing presentation in either config files :

  <servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>sortedBy</param-name>
     <param-value>LAST_MODIFIED</param-value>

    </init-param>  
    <load-on-startup>1</load-on-startup>
  </servlet>

Of course there's also the XSLT approach to have yet more control over the presentation. Check the use of localXsltFile and globalXsltFile in the default-web.xml file itself.

( sept. 18 2009, 04:03:15 AM CEST ) Permalink Comments [0]

20090916 mercredi septembre 16, 2009

JavaZone presentation posted (video)

My GlassFish v3 presentation from last week's JavaZone is already posted along with many others. If you're interested in the demos, feel free to skip right to them:
Demo #1 (developer features) @ 7:01
Demo #2 (Java EE 6) @ 21:00
Demo #3 (GlassFish à la carte) @ 26:00
Demo #4 (OSGi) @ 36:50
Demo #5 (RESTful admin) @ 49:00

There's also an offline version (close to 200MB of MPEG-4 for QuickTime in 640x480 format).

( sept. 16 2009, 11:06:04 AM CEST ) Permalink Comments [2]

20090911 vendredi septembre 11, 2009

Which GlassFish v3 download bundle is right for me?

You may have read the (recently updated) page comparing GlassFish v2 and v3 and decided to go with v3. The next question you might ask yourself is which bundle should I download? Why is the zip archive bigger than it "installer" equivalent? Here is some data to help you decide.

First of all, it's only a matter of packaging. The product (the actual bits) remains the same in all cases.

Zip or installer?
The zip installer is new in v3. As the name implies, unzipping is all you need to do. A default domain1 is already available. If you use the installer (now open source, which makes the difference between community and Sun-branded version even smaller, but see later paragraph on that), you'll be able to change port, JDK, install, etc. This "installer" bundle comes in two flavors - windows and Unix-like (an .sh script which works on Linux, Solaris, and the Mac). The installer also let's you do silent installs with a statefile which can be produced without doing any actual install.

The IPS/pkg/updatetool feature of GlassFish (which I've been talking about it a fair bit on this blog) is quite unique for an appserver, and as you may already know this is written in python and thus ships with a "native" minimal python runtime. As a consequence, to avoid having lots of different artifacts (one per platform), the ZIP or installer bundles do not contain this by default. The zip version will require the user to install pkg and updatetool the first time the command is invoked (network access is required). The installer will offer to do that as part of laying out the bits.

You may also note that the ZIP bundle is actually bigger (25% to 30%) than the installer archive. This is because pack200 (un-)compression (much more efficient on JAR files than PKZIP) kicks in as part of the installer process.

Web or Full profile?
That's an easy one since no matter which one you chose, you can install or remove packages to get the feature-set offered by the other profile. The download page (for instance on glassfish.org) has the details of what's included in which profile. With only 30 MB, the smallest download is a Web profile installer. The largest is the zip archive of the full profile at 70MB.

GlassFish (Community) or GlassFish Enterprise?
Technically speaking, the differences are minimal. The license and the branding (a new feature in v3, the software is fully brand-able) are the two notable differences (another minor one is the different IPS repositories). Feature-wise, the two distributions are the same. Of course, the big difference lies in the fact that only the Sun-branded version (GlassFish Enterprise) is supported. But again, this is one and the same product and you will in fact be able to morph a community install into a GlassFish Enterprise instance to avoid any reinstalls. More on that in a later blog.

At this time, since v3 isn't final just yet, only the community bits are available, while GlassFish Enterprise v3 will be available on the Sun.com GlassFish page. In the meantime you can download the Java EE SDK.

( sept. 11 2009, 07:31:34 PM CEST ) Permalink Comments [0]

20090909 mercredi septembre 09, 2009

GlassFish v3 at JavaZone - slides, demos and screencasts

Here are the slides that I presented on GlassFish v3 at the JavaZone conference today. All five demos went fine (some with the help of the audience), and I even got questions at the end. I'm not sure what the plans are for making the conference talks available (delay, format), so here are the five demos (almost identical) in various screencasts :

Painless development with GlassFish (deploy on change, session preservation, etc...). Use it today on any GlassFish v3 install.
Painless Java EE 6 development (James Gosling himself, only using NetBeans, not Eclipse like I did). Starts at 12:21. Same as above - any v3 version.
• GlassFish à la Carte - Part 1, Part 2, Part 3 (the closest to what I showed) - Same as above, IPS has been there from day one (much improved in recent builds though).
Extending GlassFish v3, OSGi-style (by Jerome Dochez, the GlassFish architect), note that recent promoted builds of GlassFish v3 now ships with the Felix OSGi declarative service bundle by default, no need to install it manually.
• (I don't know of a screencast showing the RESTful admin, but Rajeshwar blog would be a good start and Ludo's JavaFX demo a fun illustration). Using recent promoted builds is recommended.

Update: the video is available (streaming + QT format). Demo timing are documented here.

Let's enjoy the rest of the conference now...

( sept. 09 2009, 04:35:44 PM CEST ) Permalink Comments [2]

20090908 mardi septembre 08, 2009

GlassFishZone in Oslo

I'm flying out to Oslo in a few hours to present at JavaZone on GlassFish v3. The slides and demos are now ready. This talk will focus exclusively on v3 and a bit of Java EE 6 (just can't do justice to it in the little time that I have). I had initially listed 7 demos but quickly found out that this would be way too much to cram into the 1-hour slot, so there's only going to be 5 fairly short demos (tooling, Java EE 6, packaging, OSGi, and RESTful admin). Let's hope they all go well ;)

Since this is partly new material and certainly has some new demos I wanted to test-run this in terms of timing and sequencing of demos. So I presented this yesterday at work to several colleagues and it's amazing how much you learn by presenting it just once. Ideally I would dry-run every presentation but it needs to feel a little real with somebody listening or else I just don't get into it. Anyhow, I'll be using a shorter version for the conference but the slides I'll post will have more details.

Session details:
"GlassFish v3 - The future of app servers and Java EE is here... well almost"
• Sep 9th, 14:15 - 15:15
• Room: Sal 3

As always, the agenda is diverse (with some usual suspects) and there's is a number of sessions that I'll try to attend (conflicts preventing) - EJB 3.1, Google App Engine, Ioke (Ola Bini's new language), JSR 330/Guice (that one is in parallel with my session unfortunately), developing for the cloud, class-loaders, hudson (Kohsuke will be there, I'm sure that his session will be packed and that there will be people talking to him hours after he's done ;) , debugging your production (btrace, ...), and more. But if the organisers still have those headphones in the main room with sessions showing in parallel on 6-7 screens I might do the usual zapping (not very nice to speaker I must admit).

( sept. 08 2009, 09:36:04 AM CEST ) Permalink Comments [0]

20090902 mercredi septembre 02, 2009

Let GlassFish update itself (v3 preview refresh)

If you were a little scared to switch your preferred repository from "stable" to "dev" as explained in my previous entry, you now have the ability to simply update your GlassFish v3 Preview installed image as we've just pushed out an update to the GlassFish stable repositories (both for the Java EE SDK and for GlassFish). See Abhijit's announcement . We carried out more tests than for typical promoted releases posted on the "dev" repository to allow people to upgrade their 3-month old GlassFish v3 release.

The new stable version is build 57 and reasons to upgrade include :
• Hudson no longer has deployment issues.
• You get the OSGi declarative services (see Jerome's blog)
• Jersey moved from 1.0 to 1.1
• tons of bugs fixes
• lots more new Java EE 6 features implemented (the exact delta is hard to compute)
• the update tool itself and its CLI have been updated from 2.1 to 2.2

If you're using the SDK you probably have already been offered to upgrade.
If you don't mind using the command-line, it's easy as this single command :
% bin/pkg image-update
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                  50/50   3392/3392   72.62/72.62 

PHASE                                        ACTIONS
Removal Phase                                131/131 
Install Phase                                474/474 
Update Phase                               3544/3544 
PHASE                                          ITEMS
Reading Existing Index                           9/9 
Indexing Packages                              52/52 

You'll see that the new version for GlassFish is 3.0-57 (build 57) and that the bits are now up-to-date (no 'u' in the UFIX column).
% bin/pkg list
NAME (PUBLISHER)                              VERSION         STATE      UFIX
ant (contrib.glassfish.org)                   1.7.1-0.6       installed  ----
felix                                         1.8.0-0         installed  ----
glassfish-amx                                 3.0-57.1        installed  ----
glassfish-appclient                           3.0-57          installed  ----
glassfish-branding                            3.0-57          installed  ----
glassfish-branding-gui                        3.0-57          installed  ----
glassfish-cmp                                 3.0-57          installed  ----
glassfish-codegen                             3.0.0-20        installed  ----
glassfish-common                              3.0-57          installed  ----
glassfish-common-full                         3.0-57          installed  ----
glassfish-corba                               3.0.0-20        installed  ----
glassfish-corba-omgapi                        3.0.0-20        installed  ----
glassfish-ejb                                 3.0-57          installed  ----
glassfish-ejb-lite                            3.0-57          installed  ----
glassfish-grizzly                             1.9.15-0        installed  ----
glassfish-gui                                 3.0-57          installed  ----
glassfish-hk2                                 3.0-57          installed  ----
glassfish-jca                                 3.0-57          installed  ----
glassfish-jcdi                                3.0-57          installed  ----
glassfish-jdbc                                3.0-57          installed  ----
glassfish-jdbc-gui                            3.0-57          installed  ----
glassfish-jms                                 3.0-57          installed  ----
glassfish-jpa                                 3.0-57          installed  ----
glassfish-jsf                                 2.0.0-14        installed  ----
glassfish-jta                                 3.0-57          installed  ----
glassfish-jts                                 3.0-57          installed  ----
glassfish-management                          3.0-57          installed  ----
glassfish-nucleus                             3.0-57          installed  ----
glassfish-registration                        3.0-57          installed  ----
glassfish-scripting                           3.0-57          installed  ----
glassfish-web                                 3.0-57          installed  ----
glassfish-web-gui                             3.0-57          installed  ----
javadb                                        10.4.2.1-0      installed  ----
javaee-firstcup-tutorial                      2.0.1-4         installed  ----
javaee-javadocs                               3.0-57          installed  ----
javaee-samples-build                          0.9-4           installed  ----
javaee-samples-full                           0.9-4           installed  ----
javaee-samples-web                            0.9-4           installed  ----
javaee-tutorial                               6.0.1-9         installed  ----
jersey                                        1.1.1-1.0       installed  ----
metro                                         2.0-14          installed  ----
mq-bin-sh                                     4.4-11.5        installed  ----
mq-config-gf                                  4.4-11.5        installed  ----
mq-core                                       4.4-11.5        installed  ----
mq-locale                                     4.4-11.5        installed  ----
mq-server                                     4.4-11.5        installed  ----
pkg                                           1.111.3-30.2311 installed  ----
pkg-java                                      1.111-30.2311   installed  ----
python2.4-minimal                             2.4.5.0-30.2311 installed  ----
sdk-branding-full                             3.0-57          installed  ----
updatetool                                    2.2.2-30.2311   installed  ----
wxpython2.8-minimal                           2.8.8-30.2311   installed  ----

If you've downloaded GlassFish from http://glassfish.dev.java.net, you have not been notified because the preferred authority (IPS repository) has been set to contrib.glassfish.org by mistake. To fix this from the command-line:
% cd GLASSFISH_HOME
% bin/pkg set-authority -P stable.glassfish.org

(this assumes that there's already a stable.glassfish.org repository defined. It only sets it as the preferred).

From there you can simply issue a :
% bin/pkg image-update

and you'll be in for a 74MB download to update your existing install as shown above.

To fix the preferred repository issue from the Update Tool (bin/updatetool), simply select the image and chose "File > Image Properties" to select stable.glassfish.org as the preferred repository. You can then select "Available Updates" and do the update from there.

If you want things like the RESTful admin and monitoring, you'll need to be running a more recent build (promoted build 60 and above in this case).

( sept. 02 2009, 08:47:36 AM CEST ) Permalink Comments [3]

20090831 lundi août 31, 2009

New screencast - Django setup for GlassFish v3

In this new short (4-min) screencast, I'm mostly following Vivek's instructions on how to setup GlassFish v3 for Django deployments. I'm using a recent promoted build and getting the jython distro straight using the GlassFish updatetool.

Everything is pretty much straightforward, but making it part of the default GlassFish v3 distribution (it's currently an optional add-on) would make it as simple as install/deploy.

( août 31 2009, 04:33:06 PM CEST ) Permalink Comments [2]

20090821 vendredi août 21, 2009

Updating GlassFish v3 Preview to a more recent promoted build

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 stable.glassfish.org one (whose content hasn't changed since May) to a dev.glassfish.org authority which hosts promoted builds :

% pkg set-authority --enable -P -O http://pkg.glassfish.org/v3/dev dev.glassfish.org

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 stable.glassfish.org.

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 stable.glassfish.org 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.

( août 21 2009, 02:20:13 PM CEST ) Permalink

20090820 jeudi août 20, 2009

Java EE 6 tutorial and samples straight to your GlassFish v3 install

While the Java EE 6 tutorial and the code samples it offers are still work in progress (expect a few rough edges), it's probably a great source for getting up to speed with this update to the Java EE platform. If you've installed the Preview of the Java EE 6 SDK you've probably been encouraged to download an update to the Java EE 6 tutorial:

If you've been using the GlassFish v3 Preview bits from glassfish.dev.java.net then you may be wondering what this is all about as there is no "Tutorial" package or update showing up in the GlassFish updatetool. Whether this is a feature or a bug is yet to be decided but this is technically due to different repositories being wired in for the two different downloads (glassfish vs. SDK). You can check what your repository settings are with to following command (you can visit the URL for an HTML representation of the contents of the repository) :

% pkg authority
AUTHORITY                           URL
contrib.sun.com                     http://pkg.sun.com/glassfish/v3/contrib/
contrib.glassfish.org               http://pkg.glassfish.org/v3/contrib/
stable.glassfish.org (preferred)    http://pkg.glassfish.org/v3/stable/
stable.sun.com                      http://pkg.sun.com/glassfish/v3/stable/

If you're using GlassFish promoted builds you have a preferred dev.glassfish.org authority (repository) defined as http://pkg.glassfish.org/v3/dev/. If you're running GlassFish v3 Preview (released at JavaOne in May 2009), then it comes with a preferred stable.glassfish.org repository defined as http://pkg.glassfish.org/v3/stable/.

In both cases, in order to be able to see and add the tutorial and sample packages, you simply need to add stable.glassfish.sun.com like this :
% pkg set-authority --enable -O http://pkg.sun.com/glassfish/v3/stable/ stable.glassfish.sun.com

Once that's done, you can list the tutorial and samples packages available for install and proceed with the install :
% pkg list -a | grep javaee
javaee-firstcup-tutorial (stable.glassfish.sun.com) 2.0.1-4         known ----
javaee-javadocs (stable.glassfish.sun.com)          3.0-47.2        known ----
javaee-samples-build (stable.glassfish.sun.com)     0.9-2           known ----
javaee-samples-full (stable.glassfish.sun.com)      0.9-2           known ----
javaee-samples-web (stable.glassfish.sun.com)       0.9-2           known ----
javaee-tutorial (stable.glassfish.sun.com)          6.0.1-9         known ----
% pkg install javaee-firstcup-tutorial javaee-javadocs javaee-samples-build javaee-samples-full javaee-samples-web javaee-tutorial

This will install 17MB worth of samples and tutorial documentation and place this all in your glassfish/samples and glassfish/docs directories.

if you're running GlassFish v3 Preview (which already comes a stable repository) it is important that you then either disable or remove the stable.glassfish.sun.com authority. Failing to do so will cause multiple packages conflict on the next update of GlassFish. Here's how to disable the repository:
% pkg set-authority --disable stable.glassfish.sun.com

Of course you can use the bin/updatetool to accomplish all of the above if you're CLI-averse.

( août 20 2009, 02:21:04 PM CEST ) Permalink

20090808 samedi août 08, 2009

Latest GlassFish Podcast episode: Antonio Goncalves

It's been a while since the last GlassFish Podcast episode and even longer since the last interview, so here it goes - episode #36 an interview with Antonio Goncalves.

Antonio has many hats and this discussion covers a lot of ground starting with his recently published Java EE 6 book with GlassFish v3. We get into his favorite Java EE 6 feature, his role in the JCP as an individual contributor, his take on Spring vs. Java EE 6 and some thought on JSR 299 (the interview predates the inclusion of JSR 330 into Java EE 6). We also discuss Antonio's role as the leader of the Paris JUG inspiring more than a dozen other JUGs across the country.

Enjoy the episode.

( août 08 2009, 11:46:52 PM CEST ) Permalink


GlassFish Podcast
Get GlassFish V3
Support GlassFish Enterprise

Today's Page Hits: 448




bea conference glassfish groovy ips java javaee javafx javaone javazone jug mysql netbeans openesb openoffice opensource paris performance podcast presentation sdpy spring sun swing techdays tips updatecenter v3 webservices wsit
Links