Category Archives: Community

Migrating from Spring 3.2.x to Spring 4 and using ‘spring-mock 2.0.8’ gives “java.lang.NoSuchMethodError: org.springframework.core.CollectionFactory.createLinkedMapIfPossible”

So this is a very short post, with a ‘gotcha’. I wasn’t able to find anything about this, thats why I write it down here right now:

If you are migrating from Spring 3 to 4 and you have in your pom.xml the following dependency:


Once you migrate to Spring 4 (lets say 4.0.3.RELEASE) and run your tests you might run into a following stacktrace:

java.lang.NoSuchMethodError: org.springframework.core.CollectionFactory.createLinkedMapIfPossible(I)Ljava/util/Map;
	at org.springframework.mock.web.MockHttpServletRequest.<init>(
	at org.springframework.mock.web.MockHttpServletRequest.<init>(
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(
	at org.springframework.test.context.TestContextManager.prepareTestInstance(
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(
	at org.junit.runners.ParentRunner$
	at org.junit.runners.ParentRunner$1.schedule(
	at org.junit.runners.ParentRunner.runChildren(
	at org.junit.runners.ParentRunner.access$000(
	at org.junit.runners.ParentRunner$2.evaluate(
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(
	at org.apache.maven.surefire.booter.ForkedBooter.main(

Then all you need to do is make sure that you *DO NOT* have ‘spring-mock’ still in your dependencies configured. As it seems that ‘spring-test’ has assimilated this in its own JAR in Spring 4.

Remove from POM.xml, re-run tests and be happy again. It took me a while to figure this out. I hope it saved you some time!

Facilitating the Global Day of Coderetreat 2013 in Amsterdam

On the 14th of December 2013 – the Global Day of Coderetreat was held at ZilverlineI have experience with coderetreats and also organised one at the 7th of january in 2012, and the GDCR12.

This time I both hosted and facilitated this event. This means that besides practical stuff I also did the talking which I will explain further in this post. This was the first time I did this and I’d like to share how it was. If you want to get an impression of the day you can have a look at this slideshow.

A big thanks to Bob Forma and Diana Sabanovic who helped me with the hosting aspects throughout. This enabled me to mostly focus on facilitating.

I was anxious, especially since last years GDCR was very well done. Back then I had a great experience and I was not sure if I could give the participants the same experience. Yet, I wanted to do this: I just love sharing knowledge and give people something to learn or think about.

After attending the GDCR Facilitator Training by Jim Hurne, I had a clear image of how I wanted the participants to experience the Coderetreat: People having fun, learning from each other and the constraints given.

Thats it.

Continue reading

Terminal: Show git branch, changes, RVM ruby version, gemset.

I was looking for a way to easily print the current gemset I am in when working in the terminal. I found a stack overflow post, but it did not really satisfy me. With some googling I also found this post.

I modified the script a tiny bit (color preferences + added __git_ps1 to detect branch) and would like to share you what I’ve got.

This is the complete script I use now, copy & paste if you like.

The result looks like this:


# This shows the git branch of the current directory
function __git_ps1 () {
git branch 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* (.*)/ (1)/’

function __git_dirty {
git diff –quiet HEAD &>/dev/null
[ $? == 1 ] && echo " (changes!)"

function __git_branch {
__git_ps1 " %s"

function __my_rvm_ruby_version {
local gemset=$(echo $GEM_HOME | awk -F’@’ ‘{print $2}’)
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F’-‘ ‘{print $2}’)
[ "$version" == "1.8.7" ] && version=""
local full="$version$gemset"
[ "$full" != "" ] && echo "$full "

bash_prompt() {
local NONE="[\033[0m]"    # unsets color to term’s fg color

# regular colors
local K="[\033[0;30m]"    # black
local R="[\033[0;31m]"    # red
local G="[\033[0;32m]"    # green
local Y="[\033[0;33m]"    # yellow
local B="[\033[0;34m]"    # blue
local M="[\033[0;35m]"    # magenta
local C="[\033[0;36m]"    # cyan
local W="[\033[0;37m]"    # white

# emphasized (bolded) colors
local EMK="[\033[1;30m]"
local EMR="[\033[1;31m]"
local EMG="[\033[1;32m]"
local EMY="[\033[1;33m]"
local EMB="[\033[1;34m]"
local EMM="[\033[1;35m]"
local EMC="[\033[1;36m]"
local EMW="[\033[1;37m]"

# background colors
local BGK="[\033[40m]"
local BGR="[\033[41m]"
local BGG="[\033[42m]"
local BGY="[\033[43m]"
local BGB="[\033[44m]"
local BGM="[\033[45m]"
local BGC="[\033[46m]"
local BGW="[\033[47m]"

local UC=$W                 # user’s color
[ $UID -eq "0" ] && UC=$R   # root’s color

PS1="$M$(__my_rvm_ruby_version)$Wh$W:$EMGw$EMC$(__git_branch)$EMW$(__git_dirty)${NONE} $ "

unset bash_prompt

Compiling Stratagus on Mac OS X (10.8.2)

I loved playing Warcraft 2. I played it on DOSBox recently, but the fact that 640×480 is just plain ugly on my MPB these days made me look for alternatives.

And so I found Stratagus and Wargus.

With Stratagus as engine, Wargus as “MOD” and with the original Warcraft 2 CD you can re-live Warcraft 2 again on your machine.

On Windows you should be able to install this without any problems, installers are provided and these work just fine. However, on a Mac you might be in some hassle to get this working. In fact, there is no official support as none of the authors run a Mac. Basically this means people with Macs had to figure out how to do this. After some time of googling I got Stratagus compiling and working with a Wargus game I already created on Windows.

Fortunately someone at github already made a version that should work on Mac OS X. Combined with a tutorial I found elsewhere I got it to compile. I can play Wargus now on my Mac!

For completeness sake I have combined the steps I have taken (and also forked Stratagus) so you can use that version. Don’t credit me for making Stratagus compile on the Mac though, as I did not make the nescesary changes in the makefile or code.

Install Xcode (from App store) & Install command line tools from Xcode

in Xcode, go to preferences, tab "Downloads" -> " Components" -> Command Line Tools
  • – The command line tools should have installed git and svn for you, try them out:
hit "svn --version", and "git --version" in your terminal.
If they are not installed, you could install them via homebrew (brew install git && brew install svn) (after you installed Homebrew of course)

Install homebrew

ruby -e "$(curl -fsSkL

Installing required dependencies

I have installed the following dependencies with homebrew like this:

brew install cmake libogg libvorbis theora libpng zlib libmikmod sqlite3 doxygen

Compile and build tolua

Go to your projects dir

git clone

cd toluapp

cmake -G "Unix Makefiles"

make && sudo make install

Git clone stratagus

Determine where you want to checkout stratagus, ie in your ~/projects, then:

git clone

Compile it

cd stratagus
mkdir build
cd build
cmake -G "Unix Makefiles" ..

Now you should be able to run a stratagus game. Since I already created Wargus by using Windows, I copied this over to my mac (and put it in ~/projects/Wargus). Then I ran stratagus as:

./stratagus -d ~/projects/wargus/

A known issue I have is that on startup the screen looks as if it is drawing with a weird offset (ie too much out of screen at the upper left). By simply changing resolution this goes away. Don’t know why yet, but since we have the code now and we can compile, we might as well try to fix it some day! 🙂

Personally I’d like to see a better AI for wargus, especially since I like to play Skirmish games.

I hope this guide helped you get it to work on your mac. Please share your experiences in the comments section.