EJBContainer doesn’t have to take into account jndi.properties file. For those who were using new InitialContext() to start their (OpenEJB) container for tests it can be quite strange.
An easy way to solve it is to read manually the properties file and give the properties to the createEJBContainer method. Doing it your jndi.properties will be used but the java one (${java.home/lib/jndi.properties) will be ignored where it was taken into account before. Same with system properties…
So what to do?
Accepting to get a dependency on sun classes (quite acceptable, at least for testing) you can use the com.sun.naming.internal.ResourceManager class and its getInitialEnvironment method.
Simply replace
EJBContainer.createEJBContainer()
by
EJBContainer.createEJBContainer(ResourceManager.getInitialEnvironment(new Properties()));
And you will inherit from all the InitialContext behavior regarding jndi.properties 🙂