Google Play Store Forums

Dear Google,

since I did not find a better play to post this idea, I just did it right here ;-)

For openSCADA, the open source project I am working on, we use Google Groups as a communication channel with end users. This works quite fine actually, and I think that Google Groups are a fine instrument for that.

Sadly, when I browse through the Play Store, reading comments on apps, very often I find comments like “How can I…”. The comments, and also the possible replies are misused a form of forum, or back and forth communication channel. The next this is that the original comment gets updated to reflect a reply. All this is quite irrelevant, when I want to check if the app is worth a download or not.

On the other hand, my experience with Google Groups is, that very often users already help each other, and only when the question remains open for some time, or the question is rather specific we answer it ourselves.

I why don’t you just allow an automatic “per-app” Google Group, integrated into the Play Store App (but also accessible using the normal Google Group Website), to let users write about the app, provide self support, and provide a support forum for the application developer.

Well, I hope you read it some time.

You know were to find me ;-)

Spring WebMVC – Bad request for most pages

Today I stumbled over an easy configuration mistake you can make, which will cause “400 Bad request” for most static resources. It took me a little bit of time to figure out what went wrong.

I had a classic Spring WebMVC setup, DispatcherServlet, resource mapping for static resources (CSS mostly).

After making a few changes all CSS files started to have “400 Bad request”. Which was strange, since these were only static resources. Bad request sounded like something went wrong in the Jetty that I used. So I started debugging into this issue.

It turned out that all requests were directed to my newly added @Controller class that already was active in the Spring context. It’s handler method was causing the “400” error. By why for all CSS files?

It was a missing “value” property in the @RequestMapping annotation. I had:

public class ArtifactController {
  @RequestMapping ( name = "/artifact/{artifactId}/get", method = RequestMethod.GET )
  public void get ( HttpServletResponse response,
    @PathVariable ( "artifactId" ) String artifactId ) {
      final StorageService service = Activator.getTracker ().getStorageService ();

Where it should have been:

public class ArtifactController {
  @RequestMapping ( value = "/artifact/{artifactId}/get", method = RequestMethod.GET )
  public void get ( HttpServletResponse response,
    @PathVariable ( "artifactId" ) String artifactId ) {
      final StorageService service = Activator.getTracker ().getStorageService ();

Note: the @RequestMapping attribute should have been “value” instead of “name”.

OSGi EE – Modular Web Applications

Creating a modular web application in Java still is a tricky task. While there has been some improvement with web fragments, this still is far away from what you actually want.

But what is it that you (or better I) want:

  • Modularity – Make the application extensible using plugins. Not just one big block. Install additional functionality with a few clicks
  • Easy setup – Setting up a JEE server like JBoss can be a pain in the ass. First you have to configure your datasource with some obscure XML file. It would be way better to be directed to some sort of setup screen, asking for all database (etc.) information first. Guiding you through a setup process. With JEE your web application won’t even start if your JPA data source cannot be loaded since the driver is not specified.

Now there are a lot of applications which provide this flexibility. Atlassian, Jenkins, and a few more, all do a great job. Most PHP web applications guide you through a web setup when you first install the software. So why can’t Java do this out of the box?

When you think of modularity and services, OSGi immediately comes into my mind. However “the Web” still is a strange place for OSGi setups. Yes you can register a servlet with OSGi and access it through “http”. But that is just the start. You want JSP, Form Validation, maybe even Spring WebMVC.

There are a few setups I stumbled over, pax runner with pax web. However they bring in a pretty old jetty 7, when there is jetty 9.2.x with Servlet 3.1 support. There are some Apache Karaf tutorials, however there is also no JSP support, just a custom Vaadin bridge.

Jetty 9.2.x claims to have OSGi support out of the box. In combination with Eclipse Equinox this should be an easy setup. And although it really works, you know what you have to do. I got it working in the Eclipse IDE, but it still provides most things you really want.

In order to be able to reproduce it myself, I made a few ant script and sample projects out of what I learned and decided to put them up on github.

So if you want to build modular web applications with Jetty, Equinox, Eclipse, Hibernate Validation, Spring WebMV and more (with a recent version of all components) you can have a look at

If you have more examples working or find a bug, please let me know ;-)

Identify GSM modem devices using udev

Again an interesting problem, I do have a Linux box and it has two GSM modems and a RS-232 FTDI USB device built in. Each GSM modem brings three USB serial devices. Now I do want to dial up using the first of these modems and therefore I do need the device name, e.g. “/dev/ttyUSB2″.

However, each time the box boots up, either the RS-232 device or the modems are first in the order or devices found by the kernel. This results in the modem to be either /dev/ttyUSB2 or /dev/ttyUSB3. Since this definitely is an issue when dialing up, I would like to keep these device names persistent.

udev can help here. It allows one to influence the way devices are created in userland. Depending on your distribution, the rules files are located at “/etc/udev/rules.d/” (at least for Ubuntu).

Now my modems can be identified by vendor and product id (12d1, 1404) so a simply udev rule should be fine:

SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", SYMLINK+="gsm%s{bInterfaceNumber}"

In theory this should create additional entries under “/dev/” with map to the kernel assigned device names. For example /dev/gsm00 -> /dev/ttyUSBXX. So I could just access “/dev/gsm01″, whatever the boot order was.

The problem is that the device attribute “bInterfaceNumber” is not on the tty device, but on the usb device in the parent hierarchy.

Still it is possible to record the interface number of a first rule, and use it in a second one:

SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1404", SYMLINK+="gsm%E{.LOCAL_ifNum}"

This stores the attribute “bInterfaceNumber” into the environment variable “.LOCAL_ifNum” (the prefixed dot is a notation for temporary or hidden variables). In the second rule the same variable is pulled on using the “%E” syntax. Newer udev versions also support “$env” instead of “%E”.

Thanks to [1] for mentioning this trick!


IEC 60870 Explorer

Finally we put a few functions and classes together that we already had, and made a simple, easy to use and jet powerful tool which we would liked to have ourselves ;-) Sadly it did not exist when we would have needed it, so we had to make it ourselves.

A simple tool to access data from an IEC 60870-5-104 device. Just browse the values and send some commands.

There are already a few products out there in this area, but either are they expensive and very complex applications that provide a lot more than you actually need. And are nearly unusable if you don’t know what it is all about. Or they are simply crap.

Here is our approach to this problem: The IEC 60870-5-104 Explorer.

Creating a Mac OS App Bundle with Maven Tycho

Using Maven Tycho it is possible to build OSGi applications and therefore Eclipse RCP applications easily with Maven. Creating a ready to run product is already described on the internet a few times.

But what is mostly missing is, how to make an nice Mac OS X application bundle, that looks like a real Mac OS X application and not like a bunch of files extracted from a ZIP/TAR file.

Assuming you already have set up your Maven Tycho RCP build and are building products using the packaging type “eclipse-repository” here is what you need to do in addition.

Extend the configuration in the “eclipse-repository” project by calling (or enhancing the call) to:


If you don’t have a “configuration” element for this plugin yet, then add it as a child element and configure the specific product you are building:



“” and “” make up the id of your application. Which must be consistent with the “id” property in the “.product” file.

The most important thing is is the configuration of the “rootFolder” for the target type Mac OS X here. It would also be possible to use the plain “rootFolder” property, but using “rootFolders” (with the “s”) it is possible to just make an alternate name for Mac OS X.

In addition to that tell the repository bundle (in the same Maven project) to generate for Mac OS X.


Running “maven package” will now give you a “products” folder under your output folder (normally “target”) which hosts a zipped version of your Mac OS X app bundle, which extracts to “My” and shows in the finder as “My Application”.

Eclipse Equinox as a Windows Service

In the Eclipse SCADA project we finally wanted to create a setup of the server components for the Windows platform. Ideally all the server tasks should be integrated into the Windows service framework, so that you can stop and start services “the Windows way”.

While there seems to be a commercial solution (64bit) from Tanuki Software, we wanted (needed) to go the open source way. Which actually brings one to Apache Commons Daemon. Since we are already using “jsvc” (the Unix way) of the library, is made sense to use “prunsrv.exe” for the Windows side.

The idea is pretty simple, you specify a class that has two static methods (start and stop) which perform the task of starting and stopping your service. The service wrapper “prunsrv.exe” will take care of loading the JVM. “start” and “stop” will be executed in the same JVM instance, so if you have a global instance variable you have no issues here. Luckily Eclipse/Equinox already has an appropriate class: EclipseStarter.

Continue reading

Creating Mac OS X Icons (icns) on Linux

Time again for some new icons for an Eclipse RCP launcher. While The Gimp can easily create XPM and Windows ICO files, when it comes to Mac OS “icns” format, you won’t have any built in support.

There are some fine tools out there for Mac OS, but if you are running Linux and don’t want to buy a Mac just for creating some icon files, png2icns comes to the rescue. It is a small command line tool which simply creates an “icns” files from some “png” files.

Create your icon files as “png” in multiple resolutions. If you are creating an Eclipse RCP launcher, you will, most likely, have them anyway for creating your Windows “ico” file. Place them in any folder you like:

-rwxr-xr-x 0 jens jens 1427 Feb 24 10:49 icon_16px.png
-rwxr-xr-x 0 jens jens 2003 Feb 24 10:49 icon_32px.png
-rwxr-xr-x 0 jens jens 2560 Feb 24 10:48 icon_48px.png
-rwxr-xr-x 0 jens jens 5304 Feb 24 10:48 icon_128px.png
-rwxr-xr-x 0 jens jens 9883 Feb 24 10:47 icon_256px.png

Ensure that you have the “png2icns” application installed. On Ubuntu it comes with the package “icnsutils”, which can simply be installed by executing:

sudo apt-get install icnsutils

Now call “png2icns”. As the man page suggest you need to provide all PNG files, that you want to be part of the icon, as argument. The first argument is the output filename. Also you can let the shell find the correct PNG file by using the wildcard (*):

png2icns icon.icns icon_*px.png

Easy! ;-)

PS: If anything goes wrong, “png2icns” will complain at the command line (e.g. due to some wrong resolution).

Registering EMF models in plain java

Using Eclipse EMF/Ecore models inside the Eclipse Platform is quite easy. Loading an XML/XMI serialized model file is only a matter of some lines of code. The most interesting thing about this is that the whole Eclipse platform can handle the registration of models and model factories for you. So instead of knowing what model type you are loading, it will be detected and the right model factory will be used for loading and creating your model instance. Even better is the fact that also derived model objects can be loaded that way.

Just image you are writing a model A and extend object in the model B. So you can create a model instance which contains objects from model A and B and just serialize it to XML. Loading it back will of course give you model objects of type A and B. Although initially only model A existed and B was an extension using derivation. For this to work the resource mechanism of EMF must need to know which namespace is handled by which resource package and factory. If you are running inside an Eclipse Platform this is easily done using the extension mechanism. And the “genmodel” file and generator will automatically create the correct code and “plugin.xml” for this setup.

The problems start when you are outside the Eclipse Platform and running in a plain Java application. The default way to go is by registering all EMF models somewhere before loading the serialized models:

public void setup () {

Continue reading