Saturday, February 27, 2010

Glassfish v3 - what's the deal to have Weld and REST?


It turns out I did the right thing, but obviously needed a few more mvn clean install cycles (or in other words I have no obvious clue why this consistently failed at the start



So I've been trying to write an app that uses CDI (Weld) and JAX-RS.
As I want separate layers, I coded everything up to have a web.war, an ejb.jar and packaged everything together in an ear-file.

I've coded a bean like this:

public class StatusManager {

public String foo() {

Now I can use it in a JSF like

 <h:commandButton value="Submit!" action="#{}"/>

Works like a charm.

When I try to accces the REST endpoint I get a "resource not found". Ok,
so I add some stuff to web.xml:


Now accessing the JAX-RS endpoint works like a charm, but the above JSF action breaks and the container shows the following in the logs:

com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.

Does anyone know what is going on and how to use both at a time?

Monday, February 22, 2010

RHQ / Jopr tab sweep

Lot has happened since the last tab sweep ...


RHQ 3.0.0.B03 has been released. You can find more information on the release notes page and the bits at the download page.


There are several new videos available:


I've been talking about RHQ at FOSDEM X - the talk was well received and its recording is finally online (see above).


Spacewalk 0.8 has been released.

Joe Marques gives a tip about automation in web development

Quote html for MarsEdit

I am using MarsEdit to post my blog entries, which is a nice editor (ok, it could sometimes have a more wysiwig mode, but in total I am happy with it).

One thing that I find often annoying or missing when writing posts is that there is no build in quotation mechanism for '<' in a <pre> block (many of my posts are rather technical and contain XML snippets).

Luckily MarsEdit has AppleScript support, so I wrote this little AppleScript script (actually I copied a good part from the supplied Add Paragraph Tags one):

tell application "MarsEdit"
set currentWindow to document 1
on error errorMessage
displayErrorMessage("Can’t add paragraph tags because no post windows are open. This script works on text in the frontmost post window.") of me
end try

set currentTextView to selected text in currentWindow
set numChars to number of (characters in currentTextView)
set newBodyText to ""

repeat with i from 1 to numChars

set currentChar to character i in currentTextView

if (currentChar is "<") then
set newBodyText to newBodyText & "&lt;"
set newBodyText to newBodyText & currentChar
end if
end repeat

set (selected text in document 1) to newBodyText
end tell

This allows to quote the current selection. Save the script to
~/Library/Application Support/MarsEdit/Scripts/Quote Html.scpt.
It will then be availably in the ApppleScript Menu:

Bildschirmfoto 2010-02-22 um 09.35.54.png

To use it, just select the text and then invoke this Quote Html menu item

Monday, February 08, 2010

Small FOSDEM 2010 round up (with pics and video)

So I've spent last weekend in Brussels, Belgium at FOSDEM, gave a talk, met with some colleagues and had a great time.

Ok, this was a bit tense :)

FOSDEM 2010 was the 10th incarnation of the Free and Open Source Developer's European Meeting. There have been thousands of geeks at the ULB (UNiveristé libre de Brussels) - exact numbers are not known as there has been no official registration. THere have been tweets about being around 2000 devices with IPv4 and close to 2000 devices with IPv& active - this already shows the size of the audience.
Despite this huge number of devices online, the network was great (FOSDEM had a 1GBit link to the internet) - wireless was available in nearly every room at good strength and performance On sunday morning they even encouraged people to use more bandwidth - many much more commercial conferences should talk to the FOSDEM NOC in order to learn how to do this.

I arrived in Brussels on Saturday morning having taken an early train from Stuttgart - after Cologne I met the first two other guys heading to FOSDEM too :)

Later on saturday I gave myself a talk about Systemsmanagement with RHQ. Slides are available here.

After my talk, my colleague Mark Procter gave a presentation about Drools. When my talk was over I felt very much relieved and was more able to attend other talks. I wanted to attend some Postgres related ones, but they were already crowded.

One of the/my highlights was the talk by Andy S. Tanenbaum about Minix 3 - he presented with a good sense of humor, so it was nice to listen. His talk actually made me want to do some low-level stuff hacking again (I used to work on NetBSD in the past). Later on I was sitting in the Free Java track and was thinking that I should perhaps also start hacking on the VM. Lukily for me I did not attend all talks. Otherwise I'd probably end up with programming Drupal in Assembler for one of those little embedded boards I that the OpenEmbedded guys had on display :-)

On Sunday Dave Fetter from Postgres showed on Sunday how to compute Mandelbrot sets and solve the Traveling Salesman Problem in SQL on Postgres - totally crazy! :)

After this I have been in the Free Java dev room and met some colleagues from Red Hat, working in that area - it is always nice to finally be able to put a face behind a name.

Below are a few impressions from Fosdem and Brussels - enjoy (I will fix the image orientation as soon as I know how ... ). More pictures are e.g. on Flickr, here and here.

Below movie is also available as .ogg version (79 MB).

Thursday, February 04, 2010

RHQ / Jopr tab sweep


RHQ 3.0.0.b02 has been released

Web articles

We have set up a page that lists third party plugins and also usages of Jopr and RHQ - if you want to be listed here, contact us

Marek Goldmann has written a blog post, where he shows how CirrAS uses RHQ for management of servers in the cloud. This post especially talks about using the RHQ CLI to import and configure resources.

Mazz also refers to this in his latest blog entry. In another post he describes how to install the JD java decompiler, which also understands generics unlike the outdated (but often used) jad.

My (German) article "Polyglotte Bohnen" on JSR 223 usage at the example of JRuby got published at Heise Developer. JSR 223 is in usage in a few places within RHQ: CLI, script2 alert plugin and scriptlang alert sender plugin (and probably others).


I'm going to FOSDEM, the Free and Open Source Software Developers' European Meeting

I will talk about RHQ at FOSDEM. There will be other people from Red Hat, as well as many other interesting talks.

Wednesday, February 03, 2010

RESTEasy client : authentication

Was just playing with RESTEasy and needed to do authentication against the server.
Came up with this solution:

String userId = "myName";
String password = "verySecret";
Credentials credentials = new UsernamePasswordCredentials(userId, password);
HttpClient httpClient = new HttpClient();
httpClient.getState().setCredentials(AuthScope.ANY, credentials);
ClientExecutor clientExecutor = new ApacheHttpClientExecutor(httpClient);
try {
URI uri = new URI("http://.....");
ClientRequestFactory fac = new ClientRequestFactory(clientExecutor,uri);
ClientRequest request = fac.createRequest("http://.....);

I don't know if there is a better way, as there are a lot of steps to do here. Just thought I should share as documentation is a little sparse here.

Tuesday, February 02, 2010

RHQ 3.0.0.b02 released - includes Jopr

We are proud to announce the release of RHQ 3.0.0.b02. Like the 1.4.0.B01 release, this is a developer preview and not intended for production. As with the previous release, this includes the Jopr bits, which now also live in the combined RHQ source repository.

You may wonder about the jump in the major release number. Well, first of all, the next release will be a big jump forward for the project, so a new major number is appropriate. And then, there is a very practical reason too: as I've already written earlier, the download not only contains the RHQ bits, but also the Jopr bits, which creates some confusion in the install / upgrade process, as the Jopr bits, which in the last Jopr-release were named xy-plugin-2.3.1, in 1.4.0.B01 they were suddenly xy-plugin-1.4.0.b01. The RHQ installer assumes that plugin versions are increasing and thus is considering the Jopr plugins in 1.4.0.B01 as older.
We could have hacked around this, but just increasing the major number solves this issue in a very natural way.

New Features:

  • Some French installer messages contributed by Victor Montaner

  • Alerting

    • Much improved UI for the new alert sender plugins

    • Alert definition UI partly moved from JSF to struts

    • Improved alert senders for microblog and snmp

    • It is now possible to define templates of alert notifications that contain a bundle of senders that can be reused to create notifications for alert definitions. See menu "Administration -> Settings -> Alert Notification Templates"

    • Alert migration: the datamodel for alerts has changed an needs migration. See the README for a how to

    • NOTE: alert senders for Subject, Roles and Operation are not in this release - they will come back soon

  • Raw configuration support: It is now possible to edit the raw text of configuration files and not only the structural view of them. This includes validation and rollback

  • Operations for server side plugins: it is now possible to define operations on server side plugins, that can be triggered through the alert plugin gui (Administration -> System Configuration -> Plugins -> Server Plugins)

  • Cosmetical changes in the left nav tree

Have a look at the full release notes for more details.


You can download this release from SourceForge at There is an agent download as well, but you don't need to download this, as the agent is contained in the server download already.

The source for the community release can be found in the 3.0.0.b02 branch in RHQ git.