Just a letter to my future self:
When you use Properties and creates the entries, remember to avoid the whitespaces. The properties are inserted as-they-are, so no trimming occurs.
It might sound trivial, but it wasted at least an hour of my time, while I was searching for a bug in a totally wrong department…
Properties p = new Properties; p.put("java.naming.factory.initial", " org.apache.openejb.client.LocalInitialContextFactory");