Another talk at the JUG Görlitz about JSF and CDI

Last year I already gave a talk about JavaServer Faces and Contexts and Dependency Injection at the Java User Group Görlitz. At the january meeting of the JUG Görlitz on january the 25th I gave another talk building upon the last one. This time I explained some other features of JSF and CDI, namely:

  • navigation in JSF
  • templates and reusing of facelets
  • Ajax with JSF
  • little example with PrimeFaces
  • CDI Producer
  • Observer Pattern with CDI

Problem with el-api in Eclipse/Maven/Tomcat

Recently I have worked a lot on Java Web projects and today I got strange exceptions like this:

java.lang.LinkageError: loader constraint violation:
when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V"
the class loader
(instance of  org/apache/catalina/loader/WebappClassLoader)
of the current class, com/sun/faces/config/ConfigureListener,
and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class,
javax/servlet/jsp/JspApplicationContext, have different Class objects
for the type javax/el/ELResolver used in the signature

The origin was a little helper method that should lookup a String value in the expression language context:

private String getStringELValue(final String el) {
   String result = "";

   FacesContext fc = FacesContext.getCurrentInstance();
   if (fc != null) {
      String value = fc.getApplication().evaluateExpressionGet(fc, el, String.class);
      if (value != null && !value.isEmpty()) {
         result = value;

   return result;

This methods depends on classes from the el-api.jar. This jar is provided by tomcat per default so you don’t have to provide it with your application but to be able to compile (and test) the code with maven you have to specify the dependency in your project’s pom.xml:


Line 5 (<scope>provided</scope>) is important in this dependency definition because it tells maven to use the el-api.jar to compile and test the application but not to put it in the WEB-INF/libs folder of the resulting web-application because this jar is already provided by the server.

After a lot of investigation I found out that the maven-plugin of eclipse doesn’t care about this scope declaration. The result is that there are 2 copies of some classes on the classpath which causes the exception mentioned above.

The solution was to install the m2e-wtp plugin. As the name suggests this plugin does some kind of integration between maven and the web tools platform (wtp). After installing this plugin you have to choose “Update Project Configuration” in the maven sub-menu of your project. After this, everything was working perfectly. Maven was able to build the application and run all tests and tomcat was able to deploy and run the application without any exceptions.

After installing the plugin I got some red crosses on my projects telling me that there are still some problems. The reason for this was a wrong compiler setting. It seems that the new maven plugin tells the projects that they are of java version 1.5 and not 1.6 as it should be. The solution was to explicitly configure the compiler setting in the pom.xml:


Talk at the JavaUserGroup Görlitz about JavaServer Faces 2

On November the 30th I gave a talk about “JavaServer Faces 2” and “Context and Dependency Injection (CDI)” at the Java User Group Görlitz. I talked about some of the main features and concepts of JSF2 like ManagedBeans, Facelets and the Expression Language. After that I gave a little introduction to CDI because in my opinion it harmonizes very good with JSF2.

After the talk I developed a little example application that uses JSF2 and CDI on the projector. In this application the user can add and store notes. The project uses maven for the dependency management.

You can download the slides and the project here:


Interesting Blogs of two fellows of mine

Today I want to recommend the Blogs of two fellows of mine. First the blog of Max Wielsch in which he writes about his experiences related to computer science and software development. He is working at the same company as me and is proceeding a project I started implementing at the beginning of the year which is called the “Human Task Service”. This is a Software which integrates human interactions in Service Oriented Architectures (SOA). This is necessary because BPEL, the standard to orchestrate webservices to SOA’s doesn’t come with build in support for human interactions. Amoung other things, in his blog Max describes one component of this Human Task Infrastructure in detail which is used to monitor the hole application.

The second blog I like to recommend is the blog of Raik Bieniek. He is also one of my fellows and in his blog he writes about Acceptance Tests with internal DSLs. “DSL” stands for “Domain Specific Language” and means that there is a language (similar to programming languages) with which a customer can write acceptance tests in his own words. He doesn’t need to know technical things and terms but can use terms from his own subject area. Raik developes a framework with which you can create such DSLs for your desired subject. “Internal DSL” means that you use an existing programming language to build your DSL on top of it. The benefit is that you can use features of this existing programming language. He uses for his framework the programming language Groovy which runs on the Java Virtual Machine.


Hiding Toolbars for App-Tabs in Firefox

Some weeks ago I have written a little Addon for Firefox which lets you hide the toolbars for domains. This was mainly aimed at App-Tabs introduced in Firefox 4. The Addon was working for me and some friends but sadly the people on Firefox’s Addonsite obviously couldn’t get it to work and so it wasn’t hostet on there.

Today I have read a wikipage which stated that the Firefox developers are working on a similar functionality for a future release of Firefox. I think that’s great because this feature is really usefull.


YouPay: Android/iPhone app for roommates and everyone else

If you have ever lived in a flat-sharing community you probably know this situation: Everyone has a turn to do the shopping from time to time. Today you go shopping for 12 € and the next time your roommate goes for only 8 € and tells you that you are the next in line. That’s not fair, isn’t it?

Some friends of mine and me have thought of a solution for this problem: YouPay - An app where you and your friends can enter your expenses and the app tells you who is the next in line. There is already an iPhone app available, last week the Android version was released and I’m working on an web version of this app. At the moment I can’t say when the webapp will be ready because I have also some other projects I’m working on and there is some additional planing to do because the web version will have some extra functionality compared to both smartphone apps (of cource I don’t tell you more about this at the moment).

Please check out the apps if you are an iPhone or Android user and give feedback. Both Apps are free (this time only free as in free beer).

logo screenshot


OSGi and SpringDM workshop for the JavaUserGroup Görlitz

Last wednesday I have done a workshop for the Java User Group Görlitz with the topic “OSGi Serviceplatform und Spring DM”.

OSGi is a specification for a service-based application framework for Java. While in pure Java you use packages to encapsulate code, with OSGi you have another abstraction layer called “bundles”. These bundles can contain many packages and you can define that the bundle “exports” some of these packages. Other bundles can than “import” these exported packages to use that code. You can encapsulate different functionalities into different bundles.

One of the main features of OSGi is the ability to load a bundle at runtime. While the whole application is running you can install, update, start, stop or uninstall a bundle. So when you change some code inside a bundle or you fix a bug, the application don’t have to be redeployed to get the new code running.

With Spring DM you can combine the features of OSGi with the Spring framework. This is a great combination to build modular business applications in Java.


Fixed wrong behaviour in log4xul

Last week I was coding a little bit on my music player and as everytime I used my little logging-library log4xul. Most of the time I have the Level of the logger set to “debug” so that it prints every message. Because of this I haven’t noticed that I have made a really embarrassing mistake with the logging levels in Log4xul. I have mixed the hierarchy of the levels so that with the logging level set to “DEBUG” the logger only prints this debug-messages while when set to “ERROR” it prints everything.

Of cause this is wrong because you want the exactly reverse thing: When the level is set to “DEBUG” you want to get every message and with level set to “ERROR” you only want to get the error messages.

Now I have fixed this so the Log4xul should now work as expected.


I have also found out that I have not searched enought for other logging frameworks at the time when I started to write Log4xul. In the meantime I have found the Log4Moz framework which is made for logging within firefox extensions. It is a lot more similar to the “original” Log4J and gives you the possibility to create hierarchically structured loggers for your files.

When I first used Log4Moz I was impressed and intended to use it in the future. But then I switched back to my own logger because Log4Moz has no ability to print the messages in a textbox but only to the JSConsole and to a logfile.

I have tried to write my own TextboxAppender for Log4Moz but it only worked till I hit the reload-button. After this it crashed. I don’t know if it even would be possibile to write this kind of appender with the achitecture of Log4Moz.


How it works: Hide Toolbars in Firefox 4

Last week I finished my HideToolbarsByURL extension. Now I want to explain a little bit how it works. Because I have used this technique in my other project I thought this could probably be usefull for other people as well.

Hide the Toolbar

In Firefox 4 there was a new Addon-Manager introduced which opens itself in a new tab. If you have set your tabbar to be on top of the navigation bar this addons-manager tab has no navigationbar or bookmarksbar. This is realized with the new function hideChromeForLocation of the XULBrowserWindow object. This function is called everytime a tab is shown e.g. when you open a new tab or you switch to another tab. This function gets the current location (URL) of the tab as an argument of the type string. If this function returns true for the location then the toolbars are hidden.

If you want to hide your URL too you have to override this function so it returns true for your location. But if you simply replace this function with your own, other extensions and firefox itself wouldn’t be able to use this feature anymore. The recommended way to get your location hidden is to chain your implementation of this function with the original one.

First you save a reference of the original implementation. Then you can override the function with your own. You have to determine if the given location is your desired location and return true. Otherwise call the original implementation.

var old = XULBrowserWindow.hideChromeForLocation;

//override the hideChrome funtion with our logic
XULBrowserWindow.hideChromeForLocation = function(aLocation){

	if(0 === aLocation.indexOf("")){
		return true;
	//Call the original hideChrome-function

If the current location (aLocation) starts with “” then return true and hide the Toolbars. Otherwise call the old implementation with the aLocation as argument.

In my extension I put the URLs which should be hidden in an array. In my overridden hideChromeForLocation function I look if the current Location is in that array or not. Because I only want to check the first part of the URL (the domain) I use the nsIURI object from mozilla.


Add-on submitted to AMO

I have finished my work on the “hide-toolbars-by-URL” extension and also submitted it to (AMO). Now they review the addon and look if it’s working properly. Within the next days the review process should be finished and then the addon would be visible on the addons-page.

But you can use the addon anyway because it is already available on AMO but not visible in the search-results. So to use it you need the URL which is: [](

UPDATE: The link isn’t working anymore. To use the add-on you will have to download and install it on your own from github.</s>

The code is available at github:

Within the next days I want to write some lines on how the addon works so everybode who is interested in can use the code.