Tuesday, July 29, 2008

Netbeans: where is the servlet-api?

I am currently writing a sample servlet for x2svg. And I am also trying to use NetBeans for it (as you probably remember, I am normally using Eclipse for my daily work). Actually I even downloaded 6.5M1 as Adam Bien sounded enthusiastic about it (and the editor really feels somewhat snappier than the 6.1 one).

To be able to include javax.servlet.* I need the servlet-api.
So I went to Tools->Libraries and expected it to be there. I have downloaded the EE edition of NetBeans, that should have it, but I just can't find it. There are tons of stuff like JSF libs etc. that all depend on it in some way, but I can't just pull in the basic servlet api.

For now I ended up with including the external servlet-api jar from tomcat, but this can't be the real solution.

What am I doing wrong? Where is the servlet-api in the NetBeans distribution?

Sunday, July 27, 2008

First 100km

As I indicated in this post I have started running again some weeks ago. Now after around 7 weeks, I crossed the 100km barrier (so this makes 15km per week on average, in 2 sessions on average per week).

Lets see if I will stay motivated to do the next 100km also in 7 weeks or less.

One of my big motivational factors is clearly Trailrunner, a very cool desktop app for the Mac to file each run in a training diary and to graphically select routes and compute distances etc. It's really fun to select new routes to run.
Trailrunner is even able to create images from the route

that can be uploaded to an iPod or a mobile phone as a miniature map to go (the image shows on top the name of the way-point and on bottom the expected target time (*) and the distance from the start). Also the map data (from various map sources can be shown on those micro maps)

*): One can set an expected speed for each route which is used to compute the expected time for each way-point; this helps to adjust the running speed while on the go.

It's no full blown GPS navigation (which seems to be supported with more sophisticated devices like the Garmin Forerunner), but is very helpful when running a new track for the first time.

Saturday, July 26, 2008

Why conference calls fail (2)

RHQ plugin descriptor development - and validation in your IDE

When writing a plugin for RHQ, one has to write the plugin descriptor. While this is not complicated, it still leaves some room for errors.
The good thing (but you will hate it, when you run into it) is that when deploying the plugin, its descriptor will be validated against the defining XML Schema - and errors will reported.

Of course, you could just have a look at the structural diagram of the second part of my plugin development postings, but this doesn't really make the task of writing XML easier.

The elements of the plugin descriptor are encoded in two XML Schema files in the source code:

  • urn:xmlns:rhq-plugin : rhq/modules/core/client-api/src/main/resources/rhq-plugin.xsd
  • urn:xmlns:rhq-configuration : rhq/modules/core/client-api/src/main/resources/rhq-configuration.xsd

Which means for you, that you can use the Schema files too for validation in your IDE. The following sections show how this is done; as my base install path of the RHQ project is in /jon/jonHEAD, this path will be prepended in the examples.

Eclipse 3.3

Go to Preferences->Web and XML->XML Catalog.

IntelliJ 7

Go to Setup->Resources and enter the urn and the path. So it might look like this:

NetBeans 6.1

Go to Tools->DTDs and XML Schemas. Then select the User Catalog and click on Add Local DTD or Schema. This might look as follows:

Sunday, July 20, 2008

RHQ snmptrapd updated

Since I have created the SNMPtrapd plugin for RHQ, I have updated it with a lot of little features and corrections:

  • The listner port can be configured via gui

  • A severity oid can be configured via gui: if a varbinding with this OID is received, then it is taken to compute the even severity

  • It correctly binds and unbinds to its listening socket

  • OID to text mapping: As I am still looking for an open source MIB that fits my needs and that where development is active, I've added the possibility to put mappings of oid to text in a properties file

  • Sender address is not only for V1 traps computed

  • More information about V1 traps are put extracted and put in the resulting event.

The plugin is in SVN and its description is on the plugin wiki (which also has the link to SVN etc.).

Thursday, July 17, 2008

RHQ plugin dev - api docs online

When you want to develop a plugin for RHQ,
you can of course follow my plugin dev series. But in most cases you probably want to know more.
Of course, as RHQ is open source, you can just look at the source. Most of the time it is more convenient though to just browse api docs.

JavaDoc for plugin development is now available - check it out. The docs are for RHQ version 1.0.1.

If you have questions, join us in #rhq on irc.freenode.net or post in the RHQ forums.

Tuesday, July 15, 2008

The reorg

This is one that I had in mind for quite some time now. Actually I even had it on paper and scanned in a few years ago, but lost both versions.

I've drawn the original version directly after coming out of a meeting, as this was the only thing I was able to think of after that meeting.

Sunday, July 13, 2008

x2svg 1.2.1 released

I have just released version 1.2.1 of x2svg, a tool to render input graphs as svg and to convert the created SVG (actually any SVG) into other formats like PNG or PDF.

This release consists of two changes relative to the previous one:
  • Lines have shadows now

  • Fixed a bug, where straight lines had 'steps' in them

As usual, you can download the release from sourceforge.

Friday, July 11, 2008

Thursday, July 10, 2008

RHQ and x2svg on ohloh

RHQ and x2svg have lately been added to the list of projects on ohloh.net - if you are a user of said software, please consider passing at ohloh and to click on the "I use this" button.

Direct links to the projects:

Unfortunately, Ohloh can't know that we already were working on RHQ before open sourcing it in February 2008, so it thinks its history is still relatively short.

Tuesday, July 08, 2008

Experimental Snmp trapd as event source for RHQ (+ comments about Event polling)

I have just committed an experimental SNMP trapd plugin for RHQ. Currently it is only able to listen for V1 traps at a fixed address, but I am sure this will change :)
Incoming traps will be forwarded as Events into the events subsystem, so you can view them in the GUI and even define alarms on them (that trigger SNMP traps :-)

The plugin has its own page within the RHQ plugin community pages. This page also shows the location in SVN. The plugin is marked as experimental, meaning that it is not linked in the parent pom. To build it, you need to go into the plugin base directory and build from there.

Events processing

This plugin is also an example for processing of Events. In addition to the three components that you already know from my plugin development series, you need an EventPoller - that is a class with a method that gets called at regular intervals and which pulls the event data in. Lets have a look at the Component class, the plugin descriptor and the Poller. As the discovery component more or less follows what you have seen in part 3 of the series, I am not going to show this again.

Plugin Descriptor

The plugin descriptor is mostly as we know it. There is now one new element:

<event name="SnmpTrap" description="One single incoming trap"/>

The important part here is the name attribute, as we will need its content later again. The name is the key into the EventDefinition object.

Plugin Component

In the plugin component, we are using start() and stop() to start and stop polling for events:

public void start(ResourceContext context) throws
InvalidPluginConfigurationException, Exception {
eventContext = context.getEventContext();
snmpTrapEventPoller = new SnmpTrapEventPoller();
eventContext.registerEventPoller(snmpTrapEventPoller, 60);

So first we are getting an EventContext from the passed ResourceContext, Instantiate an EventPoller and register this Poller with the EventContext (60 is the number of seconds between polls).
The plugin container will start its timer when this registration is done.

In stop() we just unregister the poller again:


TRAP_TYPE is the ResourceType name as String - we will see this again in a second.

The remainder of this class is nothing special and if you have read the plugin development series, it should actually be no news at all.

Event Poller

This class is the only real new piece in the game.

public class SnmpTrapEventPoller implements EventPoller {

Implementing EventPoller means to implement two methods:

public String getEventType() {
return SnmpTrapdComponent.TRAP_TYPE;

Here we return the content of the name attribute from the <event> tag of the plugin descriptor. The plugin will not start if they don't match.

The other method to implement is poll():

public Set<Event> poll() {
Set<Event> eventSet = new HashSet<Event>();
return eventSet;

To create one Event object you just instantiate it. The needed type can just be obtained by a call to getEventType().

That's all

Well, that's all. Source is in the RHQ subversion repository - go and check out the sources yourself.

Feedback is always appreciated.

Technorati Tags:
, ,

Friday, July 04, 2008

RHQ 1.0.1 binaries are available from SourceForge

We were finally able to provide binaries of RHQ 1.0.1 next to the source which has been available since February.

You can find the download instructions in the RHQ wiki

Remember: you can reach us in #rhq on irc.freenode.net or via the forums.

JavaForumStuttgart 2008 (subjective review)

Yesterday I was at 11th Java Forum Stuttgart (JFS), a regional Java conference with 1100 attendees(!). The JFS featured 42 sessions in 6 parallel tracks in one day. This conference is very popular and attendees came from all over Germany. As last year, the conference took place in the Liederhalle, which offers much more space than the place the JFS has been in the years before.

I also had a talk about "Profiler, the better debugger?". The talk went well - I had around 250-300 attendees, that stayed in the room :-) I was going through some slides and then showing live examples about how to dig into unknown software with the help of the profiler.

Of course I took RHQ as example, even if it was not that unknown for me :-) After the session I got some feedback that people liked the talk and one ex-colleague told me that he is currently having the problem to dig into more or less unknown software, so that this exactly fits his needs.

There have been two talks about JBoss products / projects:

  • Advanced JBoss Cache (Carsten Mjartan): I was briefly in this session to take some pictures, but left early again, as I already know a lot about JBoss Cache, so this was no big news for me.

  • Geschäftsprozese und -regeln mit jBPM und Drools - ein unschlagbares Team (Bernd Rücker): I also know a little about this, but as I was the moderator, I had to stay :-) Seriously: Bernd gave a good talk in front of ~300 attendees about what is BPM and BRM and how you can combine jBPM and Drools.

One of the highlights shurely was the talk by Erich Gamma (about Jazz)- my talk was unfortunately at the same time, so I was not able to attend it :-(

Red Hat also had a booth at JFS:

Later in the evening there have been some BOF sessions - I have a BOF about RHQ - basically the same thing as in the SIG-JBoss meeting a week ago.

You will find the slides of my talk at the JFS pages. The slides of the BOF can be found

After the talks, there was food and free beer sponsored by IBM - and Gee Hye Lee was nicely playing piano for us.

The JFS featured good content and good food as usual, so mark the date in your calendar for next years conference:-)