Monday, December 22, 2008

Zwitscher: JavaME client for Twitter

I have written a little JavaME client for Twitter, called Zwitscher.

Over the weekend I have published a very first version, that is already able to post tweets and to get the friends timeline. So far it is still at a very basic level.

And I have only tested it on my SonyEriccson K610i phone.

If you are interested, you can download the current version from Please provide feedback.

Friday, December 19, 2008

Plugin generator for Jopr/JBossON/RHQ updated

As I wrote previously, I have written a plugin generator for Jopr, JBoss ON and RHQ, which is hosted in the RHQ source tree.

This generator asks a few questions on the command line and creates the necessary directory structure and artifacts depending on the answers.

Since the last posting, I have updated the generator a lot, so that it
is now also able to generate embedded child servers/services and also supports most of the entries in the plugin descriptor.

I have added a dedicated page for the plugin generator in the RHQ wiki.

The old 1.0 version of the binary from the previous post has been removed.

Please provide feedback and report bugs to me.

Btw: If you are new to writing a RHQ plugin, you might want to first check out the "How-To"-Whitepaper.

Tuesday, December 16, 2008

Short Devoxx 08 summary

This post is a summary of a whole week of Java geekdom gathered together in Antwerp, Belgium

The conference was sold out with over 3200 attendees (propably not all did all the 5 days, as I have seen some that only were there on the first two university days). This had an influence on the quality of the Wlan (and the total internet connection) :-/ But in total it was a really good conference. I met a lot of colleagues and other interesting people, learned new things, got three books signed and also delivered three talks.

One of the major focuses of the conference was JavaFX, others were Java 7 with support for dynamic languages and dynamic languages per se.

Of course you can also read my reviews of the individual conference days:

Day 1,
Day 2,
Day 3,
Day 4 and
Day 5

Photo of me at the speakers dinner, of me presenting and here.

Plugin-generator for Jopr, JBoss ON and RHQ

I have written a simple generator that allows to generate plugin skeletons by answering some questions. The generator will afterwards try to generate the respective artifacts. I have added it to RHQ in version 2419. Of course it is also usable in Jopr and JBoss ON.

See below on how to obtain the generator.

Sample run

This is a sample run to create a new plugin called 'test' in my RHQ tree -- user input is marked in bold. Comments at the end of line in italics are mine for explanation. Those will not show up on screen.

$ java -jar rhq-pluginGen-1.0-jar-with-dependencies.jar
Please speficy the plugin root category (Platform, Server, servIce) S What resource category is this plugin using? Most common is server or service.
Please specify its FileSystemRoot: /jon/jonHEAD/rhq/modules/plugins This is the base location of your plugin subtree within RHQ or Jopr
Please specify its PackagePrefix: com.acme.plugins The base in which your plugin should live in. The plugin package itself will be added below it.
Please specify its DiscoveryClass: TestDiscovery The name of the discovery class
Please specify its ComponentClass: TestComponent The name of the component class
Please specify its ParentType: The parent type if this plugin should e.g. be embedded into another one. Can be left empty
Please specify if it should support Monitoring (y/N): y Will the plugin gather measurement data?
Please specify if it should support Operations (y/N): y Will the plugin allow to execute operations on a managed resource?
Please specify if it should support Singleton (y/N): n Is this a singleton kind of server/service? This is e.g. true if it represents a Subsystem with individual resources below it.
Please specify if it should support ResourceConfiguration (y/N): n Will configuration of managed resources be supported?
Please specify if it should support Events (y/N): y Does the plugin gather event type data (e.g. logfile parsing)?
Please specify if it should support CreateChildren (y/N): n Can child resources be created by this server/service?
Please spefify if it should support UsesExternalJarsInPlugin (y/N): y Do you use external chars that need to be put in the plugin?
Please specify its Name: test The name of the plugin. Used for the package, the name and the top level server/service
Please specify its Description: This is a test plugin
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen run
You have choosen:
Props{category=SERVER, name='test', description='This is a test plugin', packagePrefix='com.acme.plugins', discoveryClass='TestDiscovery', componentClass='TestComponent', parentType='', fileSystemRoot='/jon/jonHEAD/rhq/modules/plugins', monitoring=true, operations=true, singleton=false, resourceConfiguration=false, events=true, createChildren=false, children=null}
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen generate
INFO: Generating...
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen createFile
INFO: Trying to generate /jon/jonHEAD/rhq/modules/plugins/test/pom.xml
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen createFile
INFO: Trying to generate /jon/jonHEAD/rhq/modules/plugins/test/src/main/resources/META-INF/rhq-plugin.xml
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen createFile
INFO: Trying to generate /jon/jonHEAD/rhq/modules/plugins/test/src/main/java/com/acme/plugins/test/
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen createFile
INFO: Trying to generate /jon/jonHEAD/rhq/modules/plugins/test/src/main/java/com/acme/plugins/test/
15.12.2008 13:53:19 org.jboss.jopr.pluginGen.PluginGen generate
INFO: Done ..

Please note, that you still need to add the plugin to the parent pom
file - e.g. like this:


Please also note that creation of children (Servers, Services) is not supported in this version.

How to get and start it

The generator lives in modules/helpers/pluginGen. So update your source, go into the directory and compile it via mvn install. To run it, change into target directory and issue java -jar rhq-pluginGen-1.0-jar-with-dependencies.jar as seen above.

For convenience you can directly download the generator from the RHQ wiki (Note: this download can go away any time).

Further reading

I am writing from time to time on my blog about RHQ and have also written a "How to write a plugin" series of posts.

We have compiled this "How to" series into a PDF Whitepaper, that you can download. It might make sense to first having a look at this paper before using the generator.


Please tell me if this generator is useful for you (of course you can also put feature requests in RHQ-Jira).

Sunday, December 14, 2008

x2svg updated to use fop 0.95 final

I have updated x2svg to compile against fop 0.95 final.
There is no new binary release yet, as I wanted to look into some other issues first.

If you are running the source, you can just do a svn update to get this minor change.

Let me know if you encounter issues.

Friday, December 12, 2008

Devoxx08 - day 5

Today is the last day of Devoxx and actually it is only half a conference day and the exhibition floor is closed anyway. Will it be a good day? Yes, of course it will.

In the first session JRuby has been presented and how easily you can write programs in it. JRuby will run most of the 'normal' Ruby programs without change - except those that are using C libraries. But even those can be used with some changes. They also showed the nice integration into NetBeans with auto-completion for a lot of stuff.

Next talk I attended was about WOTE (Write Once Test Everywhere). Brian Leonard talked about developers can effectively test apps without the need to access to lots of extra machines. But first it was a sales pitch for Solaris and OpenSolaris (and other Sun products).

After this he showed how to build a database CRUD application in NetBeans and how to turn it into a Java Web Start application, deploy it via web server and test it outside of the IDE.

The next part was about VirtualBox that he was using to test on a different guest. This part was again a big sales pitch (but then I a biased, as I am using Xen on Red Hat Enterprise Linux for work to test on different guests as well :-)

ZFS allows for Snapshots (like the NetApp filers already allowed over 10 years ago), which is kinda neat, as you can define a file system, run the tests and then roll back to the original maiden state.

I went quickly to the talk about EJB 3.1 - from legacy to secret weapon by Adam Bien. Of course I already had some knowledge, but I finally wanted to see Adam live, which I was never able before.


My last session was "Dynamic Service Management in High resolution monitoring systems". This was about visualizing data on very large screens (up to 16mx6m in size) with equally high resolutions in real time. The first part was again a sales pitch, which was still interesting, as they showed pictures of the installed screens.

After this the talk went more into the technology behind the Digital Mosaic. An interesting idea behind the software is data driven control room management, where they can update the whole wall and update screen layout when an alert arises. Of course it is also possible to just update a value on screen :-)


Picture of a 15mx3m screen

That's it from Devoxx08 - I will probably in the next days post a summary with more pictures from the conference and also from Antwerp, which is a really nice town.

Thursday, December 11, 2008

Devoxx08 - day 4

This conference day started for me with the keynote talk "Effective Java reloaded" by Josh Bloch and "Java SE 7 update" by Mark Reinhold. As the main room was crowded, I went to the overflow room. This feel strange as you see presentation and the speaker on the big screen, but just no one standing in front of you (Josh on that subject of overflow rooms: "You are not missing anything except from the dancing girls").

Josh was giving examples from his 2nd edition of his book about Generics ("Remember your ECS"), Enums (passing data in the constructor, usage of Enums instead of C-style bitfields, use the ordinal method if you really need it and know what you are doing, all Enums are serializable by default - can be used for Serialization-save singletons) and Lazy Initialization (do it only when you need it (fix circularity issue, solve a performance issues), Double check locking works since JVM 5 -- if done right "copy and paste this from the book web site").

Next Mark was talking about SE7 and especially also about project Jigsaw under the new title "The modular java platform". He was talking about Java and the JDK are big and amorphous. Running a simple hello world uses 332 classes and takes around 10 times the execution time than the same on Python. So the idea is to introduce profiles to JavaSE as they have been successful in ME already.
This can also extend into the applications by defining what we have today as a classpath as modules with version information and explicit dependencies (the next image shows a possible module and dependency tree).


Modularization is coming in the form of JSR 294 in JDK 7 (and not as JSR 277, which is not dead, but 'on hold'); OSGi is out of the game because the platform requirements for modularization are to integrate deeply in the VM and the language, but Sun is talking to the OSGi guys to make sure that the modularity work interoperates with OSGi.

In the last part of his talk, Mark was showing a list of potential features for Java 7. Among those are:

  • Modularization - see above

  • JSR 292, VM support for dynamic languages

  • JSR 203, more NIO Apis (e.g. real filesystem api)

  • Small language changes (Sage re-throw, Better type inference, Multi-catch (YAY!!) TBD) -- See blog of Joe Darcy

  • JSR 296 Swing Application Framework

  • Unicode 5 support

  • Upgrade class-loader architecture (-> deadlock prevention)

  • Swing updates

  • G1 garbage collector, HotSpot improvement

  • Thinking about a MVM-lite

  • JSR 308 Annotations on types (e.g. annotate method parameters with @NonNull and have static checkers running on this stuff, much like ItelliJ and Findbugs are doing it with their proprietary annotations).

  • Concurrency and collections updates (see. e.g. yesterday talk by Brian Goetz)

Some features that won't make it into 7:

  • Closures

  • Operator overloading

  • JSR 295, Beans Binding

The next talk I went to was titled "Towards a universal VM" with a subtitle of "The JVM is not just for java anymore" and was given by Brian Goetz and Alex Buckley. Brian was first defining VMs and what they provide and how they help you writing new languages, as you don't have to re-invent stuff like garbage collection etc. A big advantage is here, that Objects of different languages running on the same VM can reflectively call each other. Another big advantage is hat the HotSpot compiler has information about the hardware and can profile class usage etc. to optimize the behavior, which is not possible with static compilers. It also just allows for an easy implementation of a new language, as its compiler just needs to create dumb code and the VM will speed it up nevertheless.
As an example of this Brian showed results of the great ruby shootout dec 2008 where JRuby is the fastest Ruby 1.8 implementation.

The VM only has a basic set of features; other stuff (also in Java) needs to be implemented by the compiler ("language fictions"). Some of those fictions are difficult to implement efficiently (like e.g. Open classes in Ruby).


Brian when signing his book yesterday

Handing over to Alex: This is why JSR 292 is working on a invokedynamic bytecode. In addition there will be a MethodHandle that can point to a block of code. But first before getting to this, Alex was explaining why the current version with invokevirtual is slow and not well suited for other more dynamic languages.

The idea behind invokedynamic is to have the VM call in the user language to consult the dispatching for calls and to trust its result to dispatch then. The good part is that this 'boostrap' code only needs to be called once at the start and after this the direct jump can be inlined and optimized. For all the details you really should go to JSR 292 and / or also watch the recording of this session.

Next to this, Brian was back to talk about the other part of JSR 292, Interface injection. This allows you to modify existing classes to have them implement new interfaces. As an example, this would allow to have java.lang.String also implementing GroovyString. This is also implemented through some bootstrap upcall as just seen before.

There are a few other features in JSR 292, that may or may not make it in Java 7.

John Roses blog (JSR 292 spec lead) talks about all this too.

Next for me was the "JBoss SOA platform overview" by my colleague Mark Little. Mark was having some issues with his presentation template; Did I already mention that white text on light blue background is unreadable? :)

Mark was showing an overview slide of all the possible modules and then listed the features of ESB and the SOA-P(latform) product.

Roberto Chinnici was then giving an "Overview over JEE 6". As I wrote a book on EJB-3 in the past and am a user of JEE 5, this was quite interesting for me. Most of the spec parts are now in public review in the JCP. Goals for EE6 are Easier to use, profiles (full EE, web profile), pruning and extensibility. First profile will be the Web profile. In the future profiles will be defined in the JCP. The current spec just defines the rule on how those profile rules need to work.

A good thing is that the spec is now pruning deprecated stuff. Current candidates are JAX-RPC, EJB 2 Entitiy Beans, JAXR, JSR-88. In consequence this means that they (if confirmed) will be optional in EE 7.

Extensibility means that frameworks (e.g. in the Web tier) can come with a built-in description which is read by the container and which will allow those frameworks to be registered in a zero-conf way in the container (-> web fragments, located in META-INF/web-fragment.xml within the framework).

Another change (especially) in the web tier is to move more to the annotation based configuration by exception development mode.
Proposed components for EE 6 are along with minor updates of others:
  • EJB 3.1 - JSR 318

  • JPA 2.0 - JSR 317

  • Servlet 3.0 - JSR 315

  • JSF 2.0 - JSR 314

  • JAX-RS 1.0 - JSR 311

  • Connectors 1.6 - JSR 322

  • Web Beans 1.0 - JSR-299

  • Bean Validation 1.0 - JSR 303

Also new in Servlet 3.0 (next to the fragments) are annotations for servlets and filters (@WebServlet, @ServletFilter). New is also an async API e.g. for Chat room applications. You need to annotate the Servlet with @WebServlet(asyncSupported=true) and can get a AsyncContext from the ServletRequest on which you can operate. It sounds relatively easy, but can have strange effects on servlet filters, so all filters and servlets need to explicitly enable asynchronous behavior by correctly (re)codig them to support it.

Next were the highlights for EJB 3.1 - I will skip those, as I've written an entry about those in the past already. The only new one are global JNDI names for beans in the form of java:global/(app)/(module)/(bean)#(interface)

EJB components can now also be put directly into Web applications (in the war file).

Within EJB there will also be EJB 3.1 lite, which contains: Session Beans, Tx, Security, Interceptors, ejb-jar.xml. This EJB 3.1 lite can be used in JavaSE and there is a bootstrapping API for this and to embed it e.g. in a Servlet container or in unit tests. EJB 3.1 lite will be in the Web profile.

Current proposed contents of a Web Profile would be
  • Servlet 3.0

  • JSP 2.1

  • JSR-45

  • EL 1.2

  • JSTL 1.2

  • JSF 2.0

  • EJB Lite 3.1

  • JTA 1.1

  • JPA 2.0

  • JSR 250

Still controversial are JAX-RS 1.1, Web Beans 1.0 and JSR 303

Estimated release date for EE6 will be around JavaOne 2009

For the last session of the day I peeked at the Hibernate performance tuning session by Volker Bergmann. Volker points out that there is no silver bullet, but some steps that you can follow to diagnose the issues.

Volker was describing those steps starting from the 10000 feet perspective and drilling down into the details.

One of the nice things of being at such a conference is that one meets people. So for me it is/was great to meet my colleagues. But not only this. I was able to speak with the Jetbrains people about some issues I was having with IntelliJ (I am mostly used to Eclipse an IJ does some things just differently) and they helped me solving those. This is just cool - and I start liking IJ just more and more.

With all the Macs, iPhones and iPods used by Java people, this conference looks a lot like an Apple users conference :)

Btw.: There is a nice photo of mine.

Wednesday, December 10, 2008

Devoxx08 - day 3

JavaFX is strong on Devoxx, so the keynote (that I missed was about it). What I did not miss was the talk "From Concurrent to Parallel" by Brian Goetz - this was about the (possibly) upcoming JoinFork classes in Java 7. Brian was describing that the current thread and concurrency model is not suited for future computers with large number of cpu cores. JF provides some implicit divide-and-conquer algorithm working on a ParallelArray data structure. After his talk he was also signing copies of his book at one of the book stores in the exhibition area (Josh Bloch was also signing copies of his books there, even if his signing session will be tomorrow).

After lunch (there were sandwiches and soup, but when I arrived there was no more soup left), I had a talk with Mark Newton from the and went to the JPA2 session done by Mike Keith. Mike showed us the upcoming features of JPA2 and also a collection of funny signs in Canada. This talk was crowded even if a good part of the people didn't know much about JPA 1 at all.

As I am tired, there will be no photos today - I will supply some tomorrow again.

Tuesday, December 09, 2008

Devoxx08 - day 2

Today was my big day with my two presentations and the quickie session.

But first I started off with some real good coffee at my very nice hotel :) When I arrived at Devoxx, the exhibition floor was already crowded with people enjoying breakfast there and playing table soccer at the JBoss booth.



People at breakfast

I went to the "Java Performance Tooling" presentation by Kirk Pepperdine and Holly Cumminns. They really approached the topic in a funny and very knowledgeable way. Key point to successful performance tooling is to use the right methodology. The two were showing and explaining this with lots of fun, examples and demos.


If you have the chance to get the video after the conference, make sure to take the time to watch is and learn from it (there are a few spots, where you can press fast forward :). But I have definitively learned from this session.

Next for me after this talk was Quickie "I spy something ... and it's a bug". When I came into the room, the person doing the previous quickie talk had not even started due to technical issues, so I was only able to start at the time I was supposed to finish. Luckily there was time left after my presentation, so I went through the slides a little quicker - the actual code demo was exactly right. I got some good applause and also some feedback about the issues presented from the audience. One of the feedbacks was that I'd probably enjoy the "Java Puzzlers" book - will check it out.

I took some of the time until my next talk to prepare for it - the conference network is sub-obtimal and relying on it being present is no good idea for a talk.

My other two talks went well as well. The RHQ one attracted around 50 people and the Profiler one around 300. I got good and positive feedback for both and was actually talking to some folks about Jopr and RHQ later on and showing them more at our booth. I hope that there will be more questions to come.

Here are some more pictures from the exposition floor:




There are actually a lot of photos online at

Luckily I got rewarded for all the pain and hassle :-) by the speakers dinner in the Pakhuis brewery....

Monday, December 08, 2008

Devoxx08 - day 1

Pheww this first conference day started early for me: I got up at 4am (actually even woke up earlier) and left Stuttgart with the train at 5:51am. I had to change trains in Cologne and Brussels and finally arrived in Antwerp around noon. Antwerp has a great main station that goes over several levels and where a modern station has been integrated in the historical one:


Made a quick stroll to the hotel to drop my stuff and headed to Metropolis. Before doing that, I walked under the Schelde river - there is a pedestrian tunnel starting right in front of my hotel. To get down into the tunnel you can take the elevator (meant for cycles) or alternatively an escalator with wooden stairs. Way cool.


There is a tram going directly to the front door of Metropolis; tram tickets are actually quite cheap over here -- 15 € for a 5 days ticket for all of Antwerp.

After registration (which was quick) I went to our booth, which Noel and Tobias were just building. A few other colleagues also joined later - most notably the team, Sacha and Emmanuel Bernard.



I've been in Emmanuel and Max' talks and it is really impressing when you see them talking in front of the big screens and the huge audience (the rooms have 400 seats ..)



Thursday, December 04, 2008

Devoxx I am coming

Only four more days until Devoxx 08. I am just finalizing my presentations for my two Tools in Action talks:

I am also giving a little Quickie session on the 9th:

As I will be at Devoxx for the whole conference, you will also be able to reach me at the JBoss booth, where I'll be happy to talk about JBoss ON, RHQ and Jopr.

I will try to post updates about the confernce here on this blog and will also do some twittering about it.

Tuesday, December 02, 2008

Whitepaper on how to write a plugin for JBossON, Jopr and RHQ available

I am very pleased to announce that Red Hat has published my plugin development series as white paper. This document got real formatting from the Red Hat creative team - and it is looking just great. I am very pleased with it. The following is a screen shot of the title page and if you want to see more, you have to download it :)


Image of the title page of the paper

You can get the paper from those locations:

Many thanks to the Creative team for going over my "rough" text in OpenOffice and making this look so great. I also want to thank Chris Morgan for his work, as well as my colleagues who have read the paper and have given me hints on how to improve it.

Monday, December 01, 2008

Dzone interview with Greg Hinkle on Jopr and JBoss ON

Dzone has done an interview with Greg Hinkle, the project lead for JBoss ON, RHQ and Jopr.

The interview is available as a 23 minutes talk as well as in the form of a transcript. You can read it and listen to it on the Dzone site.

Wednesday, November 26, 2008

How to use the upcoming agent download in Jopr + RHQ

Mazz has recently written code that the agent can use to auto-upgrade itself and has blogged about it. This code is in the RHQ trunk - so if you want to try it, you need to install RHQ from source.

This feature is also good for an initial agent install:

Get the agent code from the Jopr server:

$ wget http://pickeldi:7080/agentupdate/download -O agent.jar

Option -O sets the name of the local file which otherwise would be 'download'. Next you need to run the downloaded jar file to extract the agent from it

$  java -jar agent.jar --install
Wed Nov 26 15:33:14 CET 2008
[header-for-install] [echo]
Installing Agent To: .
Version: 1.2.0-SNAPSHOT
Build Number: 2125
Jar File: /home/hrupp/agent.jar
[install] [unjar] Expanding: /home/hrupp/agent.jar into /home/hrupp
[install] [unzip] Expanding: /home/hrupp/ into /home/hrupp
[install] [delete] Deleting: /home/hrupp/
[install] [echo] Agent version 1.2.0-SNAPSHOT (build number=2125) has been installed to .
$ ls rhq-agent
bin conf lib plugins

Starting java -jar without any other option will show some online help about the available options.

On Unix you still need to set the permissions

$ chmod +x rhq-agent/bin/

Now that this is done, you can start the agent as usual:

$ cd rhq-agent/
$ bin/

Try this feature and give us feedback.

Sunday, November 23, 2008

First snow this year

Yesterday we had the first snow this year. Orlando was very excited and directly went outside before breakfast to remove the snow from out car (there was not enough on the sidewalk to wipe it). During the day the snow melted.

When we woke up this morning, the roofs were again white. And in the evening we sort of had a snow storm. This would have been cool to watch from inside, but we had to drive around and then it was less fun.

Lets see how this continues, as this is already more snow than what we had last winter. Perhaps we can even drive to the Schwäbische Alb, which is not too far to go skiing or snowboarding.

Saturday, November 15, 2008

Eclipse 3.4, OS X and Subversion - *rant* and success

IntelliJ has SVN support out of the box, Netbeans has SVN support out of the box (by calling the svn binary) - only Eclipse doesn't. For my Eclipse 3.3 install I have a working combination, which is old, but working (and dog slow).

When Ganymede (3.4) was out, I was trying to use it, but failed due to problems installing SVN support.

Yesterday, when looking at the x2svg sources again, I wanted to update the Findbugs plugin just to find out that Eclipse reports my configuration is borked and I can't upgrade findbugs.

I decided to give Ganymede another try and even found a 3.4.1 release. But still no SVN support in it :-( Googling around led me to this post, that gave some hope.
When I went to the upgrade pages in Eclipse, I saw another provider for SVN listed, so I tried it, installed the stuff, but at the end the situation was as before.
Ok, started to install the plugin from tigris (there is a newer version available than the one listed in the blog post).
Then I installed java hl support from mac ports

sh-2.05b# port install subversion-javahlbindings

which also first failed - mostly because some of my installed ports were not up to date.

After all this was done I was finally able to see the SVN section in preferences and the javaHL connector selected.

But wth does the Team context menu not show any option like commit or update? Do I need to add the SVN repository on the SVN repository explorer tab? I did so, but no immediate change.

Ah, there was this one last trick: Go to $workspace/.metadata/ and remove basically everything below it and then re-import all projects again. And all of a sudden I had SVN support in Ganymede. It would probably have been ok to remove just the entry for this one old svn plugin -- but which one is the right one?)

I mean, it is no rocket science, why can't Eclipse get this right out of the box?
I spent over 3 hours to get it to work.
The only good thing is that comparing the on-disk state with a remote version is much faster than what I previously had in 3.3.

Friday, November 14, 2008

X2svg: how to create diagrams (in the XSD parser)?

For some simple stuff it is easy to create diagrams with x2svg - here is an example from the test suite:

$ sh -c :pdf test-src/resources/sample.xsd root

This creates a PDF version of sample.xsd along with a SVG one (technically speaking, it creates a SVG version and converts it to PDF afterwards), where the root of the tree is the element root. There are no limits, so the whole tree with all its children is shown.


But how to tackle more complex things?

The XSD-Parser has some options that we will have a look at:

  • -d n: this limits the depth of the tree to n, where a depth of 0 means the root element only and 1 means one level of children:


  • -st : This option tells the parser that the given root element is not an element, but a type.

  • -lt : If this element is given, then elements of an given type are not filled with the content of the type, but the type name is specified:

    $ sh -c :png test-src/resources/inheritance.xsd parent-type -lt


    Note, that there is currently a little display bug.

Those options allow you to create already good quality structural content from your schema files - see e.g. Part 2 and Part 4 of my RHQ plugin development series.

Wednesday, November 12, 2008

Review of yesterdays talk about RHQ&Jopr (with pictures)

Yesterday I've been talking about RHQ at the Swiss Java Users Group in Zürich. This was a good session with around 50 people.

While Zürich is not far away from Stuttgart, it took me nevertheless some time to get there. With the current issues around ICE wheels, the train wasn't able to go as fast as desired and we arrived 25mins later than expected -- luckily I've taken one train earlier anyway.

View over the shoulder of the train driver when leaving Stuttgart main station

Rheinfall in Schaffhausen as seen from the train

When you look at the date, it was 11/11 which is also start of the so called 5th season, carnival. So at the main station, there were already groups of Guggen-music playing in their costumes. Later on I saw them throughout the city at various places. It's great fun to listen to them, as they are full of energy. Even as they are playing the same instruments as the boring (German only?) brass bands, it is not the same at all.

Guggen music in Zürich main station

I went to my hotel (Limmathof, close to the main station), checked in, deposited my bag and then strolled around a bit. When I wanted to take the tram to the Technopark I had to find out that the ticket dispenser only accept swiss coins. So I had find an ATM, get some swiss money (I am no longer really used to get some other currency when traveling in Europe, as I never make it to UK and in so many other countries, the Euro is happily accepted). After I had to buy something as the note to coin exchanging machine did not accept 50 SFr notes. But after all I succeeded. So if you go there, make sure to get at least 10SFr in coins as soon as possible.

The talks in the Technopark were held in a room called "Fortran" - how strange for Java related talks :) When setting up the Laptop I had to find out that the German Schuko plug would not fit the existing outlets. Luckily someone had an adapter and we found an outlet that accepted this adapter.

In my talk I was first showing some slides about what RHQ is, where it comes from, how it relates to Jopr and JBoss ON, then showing some bits about resources and the subsystems. Then I was demoing the live application. I wanted to show that monitoring the thermometer chip would also be possible, but this failed at the demo (later I found out, that libusb was missing in my agents lib/ directory. When I added it to the running agent and did a restart of the plugin container, it worked like a charm).
After this demo, I briefly showed the bits about plugin development. Unfortunately one can show and tell sooooo much around RHQ and Jopr that the time was already up.

I think my talk was well received, I saw some people taking notes and also had people asking questions and making suggestions. I guess I will get some more feedback from the organizers, as they've distributed some feedback forms for the attendees to fill in.

Next after my talk and a short break, Bela Ban was giving a talk about how to tune a web application that is clustered and that uses JGroups and JBossCache for replication purposes. Bela first presented some baseline figures and then tweaked replication of the session versus attributes, buddy replication versus total replication and also replication on access of getters versus setters. Bela was also showing some architectural set ups for clusters that have been proven to work well.

End of story was that with some tweaking and possibly some small application code changes one can gain a big lot of performance.

Bela's session

Bela was also talking about the new mod_cluster from JBoss. If you haven't heard about it, check out its web page. Basically mod_cluster tries to solve the configuration issues that exist around mod_jk. Configuration of mod_cluster is done on the JBossWeb side where nodes announce themselves to the frontend httpds. Also the JBossWeb instances can send their load information to the apaches who react upon it. The computation of the load is pluggable.
Another cool thing is that JBosWeb can tell the apaches that a web application is going down, so the apaches know no longer to serve this node.

After the talk we had an apéro in a room called "Pascal", where I also met with Thomas and Galder from the Neuchâtel office. Unfortunately Fady did not make it as well and Thomas directly had to leave afterwards again.

After the apéro, Bela, Galder, Silvano from the Jugs and I went to an Italian restaurant (Il Gallo at Escher-Wyss-Platz) where we had some good discussions and good food too.

After I have dropped my laptop off at the hotel, I strolled around the city some more - really great. This morning I took the ICE back to Stuttgart and am now back at my desk :) Here are some more impressions of Zürich.

Polybahn as seen from my hotel window

Zürich and Limmat river by night

Vending machine that not only dispenses sweets, but also fuses(!)

Arrival of the ICE in Zürich for my way back to Stuttgart

Monday, November 10, 2008

Deep Purple in Rock

Last saturday we've been at the Deep Purple concert here in Stuttgart in the Schleyerhalle. The Schleyerhalle was nearly sold out. After Gotthard as opener (they played 1:15h), Deep Purple started fast and furious with some tracks that I did not know (probably some newish :-) stuff).

But there have been enough 'classics' too and it was a great concert again. Don Airey is a good replacement for John Lord, but I missed the Organ-Guitar question and answer game, that John Lord and Richie Blackmoore were doing.

Deep Purple played 1:30h and then again 30 minutes.

It was a great concert and I would go there again.

Monday, November 03, 2008

About blog postings ...

There once was a developer

Who was working on JBoss' Jopr

He wrote some lines of code

And took a larger note

But forgot to write on Blogger

YouTube - Macintosh Virus Discovered

This is a way cool video about a virus for Mac OS X:

YouTube - Macintosh Virus Discovered: ""

It's probably not suitable for small children :-)

Friday, October 31, 2008

Devoxx advertising

As I am going to talk at Devoxx, I will also help to promote the conference by putting a banner online:

Click on it to get to the registration page

Thursday, October 30, 2008

Clustering work in RHQ and Jopr

My colleague Joseph recently wrote about cluster management in upcoming RHQ 1.2. Don't confuse this with the cluster work we have done for RHQ 1.1, where we added the clustering of the RHQ server itself.
The goal in RHQ 1.2 is to be able to cluster resources together and operate on them. You will probably say that this is already possible with compatible groups. But this is only half of the truth. Go and read Joe's posting.

In addition to the RHQ side, we will also work on clustering JBoss AS servers in the Jopr project. I have set up an initial requirements document for this. I am looking forward to your comments on this.

Managing a cluster of JBossAS servers includes a big part of managing JBoss Cache instances and their underlying JGroups infrastructure.

I've started a JBoss Cache plugin for Jopr some time ago. If you are interested, check it out and use it in RHQ / Jopr and Embedded Jopr.

Wednesday, October 22, 2008

Red Hat News | Project Jopr: JBoss Operations Network Now Open Source

After we released Jopr last week and even had an announcement on TheServerSide (My first posting there!), there is now an official Red Hat press release:

Red Hat News | Project Jopr: JBoss Operations Network Now Open Source.


And btw.: I even added a first 'draft' of a JBoss Cache plugin to Jopr since then.

Tuesday, October 21, 2008

Qype - where is the content?

I am a heavy user of Qype and have already contributed quite a lot, but recently the site is overloaded. And worse: you don't even find the content anymore:

(Click for a larger image)

You can see that the place has 4 stars on average. You can see that you can win something, you have a place to comment, you can book an ad for this place but where is the content, that made up the 4 stars?

Well, the solution is here:

Bild 1.png

There is only content in French, so it is hidden from me - and only when I open that popup, I will see that there is actually content. This sucks!

And for my 1280x800 display, this page is just too full. The page layout has been a lot better in the past.

Thursday, October 16, 2008

Jopr - JBoss Operations Network 2 goes open source too

You have heard about JBoss Operations Network 2?
Then you probably also know that RHQ is its upstream project (like in the Fedora / Red Hat Enterprise Linux case).


If you had a look at JBoss ON 2, you have surely also seen that RHQ does not have all the features, JBoss ON 2 has (namely monitoring and management of JBossAS was missing).

This hole has now been closed by Jopr. Jopr closes the gap between RHQ and JBoss ON 2, builts on RHQ as its infrastructure framework and serves as open source upstream for JBoss ON 2

You can find it at

Forums are also available for Jopr

Embedded Jopr

Next to Jopr we have another thing coming for you: Embedded Jopr. This is a new management console for JBossAS instances that shares parts of the underlying infrastructure and plugins with RHQ and Jopr. You can deploy and use it on JBoss AS 4.2.x, as described on the install page.

Embedded Jopr has its home page at

Forums for Embedded Jopr also live on

Join us ...

The Jopr team has registered #jopr on, so come an join us there (as well as on #rhq on the same server network).

Tuesday, October 14, 2008

Fady talking about RHQ and JBossON @ Gitex in Dubai

My colleague Fady Matar will give a talk about SOA and JBoss ON at Gitex conference in Dubai.

You can find out more about his talk on his blog.

Saturday, October 11, 2008

1.1.0 Release - RHQ-Project

RHQ 1.1.0 has been released!

My colleague Joseph Marques has written a summary article about the contents and scope of this release:

1.1.0 Release - RHQ-Project

As you already know RHQ is also the upstream for JBoss ON 2, so you can expect more in the following days (especially as the availability of JBoss ON 2.1 has been announced for this month already).

Joseph lists major improvements in his article, one being support for Java 6. So this actually means that you can now run a fully open source Java Management and Monitoring system:
And of course you can get support for this whole stack from your preferred Open Source company: Red Hat !

Thursday, October 09, 2008

RHQ 1.1 has been tagged GA -- and brings High Availability

The RHQ code base has been tagged with the GA (General Availability) tag for release 1.1 and brings a lot of new features and improvements. Most notably this includes High Availability (HA) for the servers.

What does this HA mean? Well, you can now have multiple servers in a server cloud that handle incoming agent connections. If one of the servers fails or is put into maintenance mode, the agent will transparently fail over to another server in the cloud.

Setup of HA is also quite easy: just upgrade to RHQ 1.1 and it comes for free. When you add a 2nd server and have it point to the same back end database, it will automatically join the server cloud.

You need to pay attention to two things though:

  • All hosts for agents and servers need to have valid forward and reverse mappings in RHQ 1.1 -- even if you don't use HA
  • If you are using more than one server, you obviously need to increase the allowed connections on your database.

And as always: make sure that the clocks of the involved machines are in sync (e.g. by using ntp).

Watch out for more upcoming posts about RHQ 1.1 and JBoss ON 2.1, which was announced for this october too.

Wednesday, October 08, 2008

Upcoming speaking engagements (updated)

If you want to get the latest news on RHQ and JBoss ON 2, join me on the following dates:

I am looking forward to meet as many of you as possible.

Monday, September 22, 2008

PMD rule to check for unguarded log.debug() and install in Eclipse

Lately I've written a PMD rule to check that calls to log.debug() are guarded by some if (log.isDebugEnabled()) guard.

Adding it to the PMD commandline is relatively easy. Put the class in a jar and put it on the classpath:

snert:/devel/tools/pmd-4.2.3 hrupp$ java -cp \


  lib/asm-3.1.jar:lib/my.jar \

  net.sourceforge.pmd.PMD /source/to/check text \


my.jar contains the classes and ruleset.xml the description for this ruleset

Now with Eclipse, things are a bit more complicated. There is a GUI to basically write
the ruleset.xml in the preferences, but how to add the rule class? I am sure, this can be
done via a Feature Extension, but I didn't find a description quickly.

So here is what I did:

  1. Shut down eclipse

  2. Locate the PMD core plugin in eclipse/plugins (e.g. net.sourceforge.pmd.core_4.2.1.v200804111600)

  3. Copy the rules jar (my.jar from above) to lib/

  4. Edit plugin.xml and add an entry for the jar:
          <library name="lib/commons-logging-1.1.1.jar">
    <export name="*"/>
    <library name="lib/my.jar">
    <export name="*"/>


  5. Start eclipse with option -clean

  6. Now go to the Preferences to the PMD->Rules Configuration section, click 'Add rule...' and add an entry for our new rule:

  7. Start chasing bogus log.debug() usages :-)

This rule is not yet perfect, as it lacks proper type checking for the 'log' variable. It will probably also fail for Statements like "if (cond1 && log.isDebugEnabled())".

You can find the code here.

Please let me know when you have solved the type checking or how to better integrate it with Eclipse.

Wednesday, September 17, 2008

Upcoming talk: JBoss Clustering and Monitoring-Suite in Zürich

Bela Ban and myself will give presentations at theJUGS Event 11.11.08: Jboss Clustering and Monitoring-Suite:

Bela will talk about Tips and tricks to get better performance out of JBoss Clustering

And I will talk about JBossON Management platform and RHQ, its open source upstream

You can find the complete description at the page of the Java User Group Switzerland, where you can also register for the event.

Tuesday, September 16, 2008

RHQ commits mailing list (updated)

We finally made it possible to track SVN commits from RHQ in a mailing list.
I know that many of us like this a lot, even if the view-svn function also allows easy browsing.

You can find the new list on Sourceforge mailinglists, where you can subscribe yourself or
also view the archive (which is pretty much empty while I am writing this post).


When I first wrote this post, messages were flowing but had no content. This is fixed now.

Monday, September 15, 2008

RHQ: decomposing plugins

I've been talking a lot lately about how to write plugins for RHQ / JBossON.
When you try to manage larger systems like the JBoss Application Server with all its subsystems like Cache, Transactions, JBossWeb etc. your plugin might get relatively large to support all this.
In this posting I will show you how to decompose a large(r) plugin into smaller ones that all together allow you to manage the large(r) system.

This decomposition not only allows you to more easily distribute the development load, but also enables re-use of the parts that have been broken out of the big chunk. The price you have to pay is relatively small and consists mostly of some additional directories and a maven pom.xml file (that I am not going to show here).

The basic trick is to use <depends> and <runs-inside> tags in your plugin descriptor (rhq-plugin.xml) for this new plugin:

<plugin name="JBossCache" ... >
<depends plugin="JMX" />
<depends plugin="JBossAS" useClasses="true"/>

So we need the JMX plugin and the JBossAS plugin (currently part of JBoss ON only) being deployed before our plugin can start. The attribute useClasses means that the classloader of our plugin gets access to the classes of the other plugin (JBossAs here). So we can use those classes too.

<service name="JBoss Cache" ...>

As you know from previous posts, a service can't just "hang in the air" - it needs another server or service as a container. This is where runs-inside comes into play:

<parent-resource-type name="JBossAS Server" plugin="JBossAS"/>

So our plugin service "JBoss Cache" will be contained in resources of type "JBossAS Server" that come from the JBossAS plugin (that we declared in the depends element earlier).

Apart from this little magic in the plugin descriptor, there is no more additional work to do.

Voilà, RHQ plugins à la carte ... :-)

Monday, September 08, 2008

OOO 3.0 RC1 is out - and does not longer immediately crash on Mac

Open Office released the first release candidate of OOO 3.0.

And opposed to the previous betas, it doesn't immediately crash on my mac (Tiger). Well, this sounds too bad, actually, I did not run it for too long and in this time it did not crash at all.
This does not necessarily mean that it is stable, but the previous versions did crash after that time.

UPDATE: I am just editing a 25 pages document without any issues, so it is really usable now.

I am really looking forward to a final version now.

Wednesday, September 03, 2008

Driving a digital thermometer with RHQ (Part 2)

After we have installed all prerequisites last time, we can now concentrate on the RHQ plugin itself.


I won't explain every little bit and will concentrate mostly on the hardware side. If you want to know more about plugin development, go to the RHQ plugin community pages and make sure to check out my RHQ plugin development series.

Plugin architecture

The following picture shows the (hardware) components involved:

The DS9490 is the USB-1-wire adapter used. It has internally a DS1990 compatible uuid chip, that provides a unique id for the adapter. On the bus we have a DS1820 compatible thermometer and can have other 1-wire chips (future).

So our plugin will follow this hardware setup. For the DS9490 we will have a OneWireAdapterComponent + -Discovery and a separate component for the DS1820 plus its discovery component.

Plugin artifacts

Lets have a look at the individual artifacts of the plugin. I will not show everything in great detail -- check out the full source (see below).

Plugin descriptor

 <server name="OneWireAdapter"
description="A single OneWire(r) adapter hosting many devices"
<c:simple-property name="type"
displayName="Adapter type" required="true"
<c:simple-property name="port"
displayName="Adapter port" required="true"

So we have a Server per USB adapter. The server has two configuration options for the kind of adapter and the port it is hanging on. For now, I have put some defaults in, as the code only supports the DS9490 kind of USB adapters anyway (and with all the legacy free PCs around, does anyone remember serial interfaces?). The server itself is hosting the individual types of chips as services:

      <service name="DS1820" 
description="DS1820 Thermometer chip"
<metric property="temperature"
description="Temperature measured"


As the thermometer only returns one value - its temperature, we only have one numerical metric
that we show on the IndicatorCharts page by default (displayType=summary).

If you want to add more kinds of 1-wire (r) devices, you can add them as services next to the DS1820 service.


Now that we have seen the plugin descriptor, lets discover the USB-adapter: OneWireAdapterDiscovery.discoverResources() looks like this:

        Configuration pluginConfig = context.getDefaultPluginConfiguration();
String device = pluginConfig.getSimple("type").getStringValue();
String port = pluginConfig.getSimple("port").getStringValue();
DSPortAdapter adapter = new PDKAdapterUSB();

First we get the config property defaults from the descriptor. Then we create a new adapter object (this is the place where you could call into OneWireAccessProvider.getAdapter() from the 1-wire SDK to use other adapters). And finally we open the port. Next, we probe if there is actually an adapter present (the selectPort() above will probably already fail if none is present):

        boolean found = false;
found = adapter.adapterDetected();

If everything is ok, we can put the adapter in the list of discovered details.
The unique resource key is determined by reading the uuid from the DS1990 chip in the adapter:

    private String getIdForAdapter(DSPortAdapter adapter)  {
Enumeration<OneWireContainer> devices =
while (devices.hasMoreElements()) {
OneWireContainer cont = devices.nextElement();
String name = cont.getName();
if ("DS1990A".equals(name) ||
"DS2401".equals(name) ||
"DS2411".equals(name)) {

return cont.getAddressAsString();

We loop over all devices on the bus and check if its a DS1990 or compatible. If found we return the address. We could additionally check if the device is a family 81 device in case that there are more
of those devices present.

At the end of discovery, we free the adapter again:


Now that we have the adapter discovered, lets look at the resource component for it.

First we need to start() it. This is simple. First we read the configuration data again.
Then we just open the port:

        if (adapter == null) {
adapter = new PDKAdapterUSB();

The check if the adapter has been set already serves to prevent multiple calls to open the same
port over and over again, which will fail.

Availability reporting uses the same adapterDetected() method as discovery above, so I won't show this again. Same for stop() - this just frees the port again.

In addition two methods are provided for the children:

reopenPort() frees the port and reopens it again. getAdapter() makes the shared adapter available to
the child classes.


This class discovers the DS1820 thermometers.

public class DS1820Discovery implements 
ResourceDiscoveryComponent<OneWireAdapterComponent> {

As we implement the ResourceDiscoveryComponent matching the OneWireAdapterComponent just seen, we have access to this class and especially the getAdapter() method to use this shared adapter instance.

In discoverResources() we loop over the devices on the bus and see if they are of family 10.
In this case, we cast to the appropriate class and use the information from it to create the details:

        DSPortAdapter adapter = context.getParentResourceComponent().getAdapter();
OneWireContainer cont = adapter.getFirstDeviceContainer();
while (cont != null) {
if (cont instanceof OneWireContainer10) {
cont = adapter.getNextDeviceContainer();


Finally the resource component also matches the OneWireAdapterComponent. Start()ing it mostly means getting the adapter and the resource key and to otain the right OneWireContainer from the adapter.
Stop() is a noop and availability reporting checks if the container is present or not.

The Implementation of the MeasurementFacet, getValues() does the real work in this class:

            if ("temperature".equals(metric.getName())) {
boolean good = true;
byte[] data = container.readDevice();
double temp = container.getTemperature(data);

As I have seen some strange spikes, I have added a check that if the temperature is above 75C, we don't report it. This could be optimized in a way that we store the last values to see if the high value is feasible. Or we could try to determine this from the device status somehow.

Getting the source

The source is available from RHQ svn, but not enabled in the main build. You have to go into the $RHQ/modules/plugins/onewire directory to build the plugin.

All resources are described on the Plugin page on the RHQ wiki

That's it

That's it - I hope you enjoyed these two postings and I'd love to see contributions to RHQ to drive other devices as well.

Tuesday, September 02, 2008

Driving a digital thermometer with RHQ (Part 1)

When starting this post I set the title to "Home automation with RHQ".


But this would have been a little exaggerated at first and perhaps RHQ is - if you don't have other stuff to monitor and manage - like to break a butterfly on a wheel. But anyway a system like RHQ is (or will be) well suited to be the central brain of a home automation system. Of course, if I say RHQ, this applies to JBossON 2 as well.

A bit of background

I was for the start just looking for a cheap USB thermometer, but was unable to find such a beast. What
I found was a relatively cheap temperature sensor at German electronics dealer Conrad electronics, but the usage wasn't simple to decode first :) So I searched further.

Inspired by an article in German Linux Magazin, I started to look at the 1-wire protocol (which the above sensor uses) by Maxim. This 1-wire bus can operate many devices daisy chained together. Each device has its unique id, so it can be directly addressed by it (and which also suits nicely the unique resource key constraint in RHQ). There is actually a whole bunch of devices for the 1-wire bus like hubs, power injectors, actors and sensors available -- even a LCD.

The first thing that is needed is an USB-Adapter DS9490R (I got it from here in Germany, there should be other vendors like e.g. Hobby Boards).

Next, we need a thermometer chip like the DS18S20. In addition some wire, a RJ11 connector, a soldering iron and some solder. For the wire you can just take an old telephone cord that has the RJ connector still attached.

Doing some hardware work

I hope you know on which end you have to hold a soldering iron :-)
(If not, get a DS9490B with a iButton version of the DS1820 (DS1920) and skip this section :-)

Ok, if not yet done, hook up the wire to the RJ11 connector. Actually we only need the middle two pins, that are marked in the next example:

  • RED (pin 3= data)

  • Green (pin 4 = GND)


If this is done, heat up the soldering iron. On the DS18S20, you also only need two of the three pins, the rightmost can be used for external power, but is not needed in our case.

You have now to attach the wiring to the chip: put the ground (green in my example) on the left pin and the data line on the middle one - this could look like on the next image:


At the end, put some isolation (duct tape) between the pins and wires and you are ready to go.

Installing the needed software

The installation of the needed software is a little hairy.
Basically it follows the example from comment #5 on this blog posting. It is written for Mac OS X, but will apply with minor changes to other systems as well.

  1. Download libusb and install it into /usr/local

  2. Download the PDK from Compile this by running make. If you are not on a Mac you probably need to change a few compiler settings. If this succeeded, you can run a test program via make test. This should output some stuff -- and especially that the adapter has been found. If you have attached the sensor to the adapter, it should print two lines that start on 'adress:' (e.g.:

    find first: true
    address: D70008017DFCC410
    address: 5D0000002B3C2081

    Install the created libonewireUSB.jnilib to /Library/Java/Extensions/ (if you are on a Mac, ymmv else).

  3. Download the 1-wire SDK from Maxim. This package contains a jar archive OneWireAPIsrc.jar -- extract this

  4. Add the class PDKAdapterUSB.class from the PDK into the right folder of the OneWire src that you just unpacked

  5. Compile the classes from the OneWire sources and build up a jar archive (OneWireApi.jar).

    If you want to use the example code from the OneWireApi, you have to modify to be able to load the PDKAdapterUSB. I also had to commend out a few java files for the serial adapter access, as they gave me compile errors).

  6. Install the OWlib in your local maven repo like this (replace /Users/hrupp with the path to your maven repo):

    mvn deploy:deploy-file -Dfile=OneWireApi.jar -DgroupId=com.dalsemi -DartifactId=OneWireApi -Dversion=1.10 -Dpackaging=jar -Durl="file:///Users/hrupp/.m2/repository/"

That's it for now, we now have all prerequisites. In the next posting I will describe how to write the RHQ part of this.

Friday, August 29, 2008

Tuesday, August 26, 2008

RHQ: Compiling the apache snmp module on Mac OS X

RHQ and JBossON allow you to monitor Apache servers through its apache plugin. We have official support via precompiled plugins for Linux and Windows and instructions in the JBossON wiki on how to compile this for other Unixoids. While Mac OS X is a Unixoid (under the covers :-), the compile of the snmp module will not directly succeed.

I want to show here how to do that anyway (I did this against apache 2.0.63 from Macports):

  • First, if not yet done install Macports

  • Then, install libtool from within macports

    sudo port instal libtool

  • Chdir to <JON_AGENT_INSTALL_DIR>/product_connectors/apache-snmp/source

  • Edit the build script ( to replace two occurances of libtoolize with glibtoolize

  • edit snmp_common/ucd-snmp/agent/auto_nlist.c
    to include <sys/types.h> : (around line 30)

    #include <sys/types.h>
    #include "asn1.h"
    #include "snmp_api.h"

  • Run the build as indicated on the build page

  • When adding the snmp module config to httpd.conf, specify /var/db for SNMPVar:

    SNMPVar /var/db

Done! :-)
You can now (re)start apache and take it into inventory.

To do this, please specify the root path of the server and the relative path to the htttpd binary, as apache2 from macports is called 'httpd' and not 'apache2', so it won't be correctly detected otherwise.

Tuesday, August 19, 2008

Reflection, the complicated way .. :-)

Just found that in some code, had to share this gem:

Object o = ...;
try {
bsh.Interpreter i = new bsh.Interpreter();
String bar = i.eval("");
catch (bsh.EvalError e) {

Ok, not everyone is intimate with reflection and Interpreters often don't care what exact runtime type an object is (as long as you they are assignment compatible), but the effort to call BSH for this is as high as to write some reflection code for it :-) Also pulling in BSH mean for that piece of code to quadruple the binary size ...

Friday, August 15, 2008

RHQ monitor arbitrary JMX servers (Eclipse as example)

While RHQ is focusing on providing specific resource types with specific operations and metrics on them, it is possible to just connect to any JMX server (actually that code is in SVN Head as of today).

This example will show you how you could use this to e.g. monitor your Eclipse instance. This basically consists of two steps:
  • instrument the target app -- Eclipse in this case

  • manually add a JMX server to the RHQ inventory

Step 1: instrument Eclipse

Add the following to eclipse.ini:

as we don't want for this example password authentication and ssl (of course you should do that for production, but we want to concentrate on how to initiate the connection at all), we disable it by supplying

and restart Eclipse afterwards.

This page at Sun explains the various options for JMX remoting in JDK5.

Step 2: Manually add a JMX server in RHQ

Go to the inventory tab of the platform and select "Manually Add": "Jmx Server" below the list of child resources. Press OK


On the next screen select "JDK 5" from the drop down and continue:


The following screen will show prefilled connection properties - here we need to set port 10000 from above:


Click on OK and the new Java VM should appear. After some waiting, you will see the inidividual MBeans as you know it from other services in RHQ:


Technorati Tags: