Some time ago I stumbled on a weird exception when deploying an EAR on IBM WebSphere Application Server 8.5. The EAR got successfully installed, but when the application server tried to start the WAR archive of my EAR I got this exception:

After searching the web for this exception I came to the conclusion that I have to debug it on my own. Some days of debugging later I found out that there was a configuration problem that was not obvious. So I decided to write this blog and I hope that it can safe you a lot of time.

The problem arises when versions of the JEE descriptors (e.g. web.xml, ejb-jar.xml) and the type of container specific descriptors (e.g. ibm-web-bnd.xmi or ibm-web-bnd.xml) are not compatible.

In my case the version of the WEB-INF/web.xml in my WAR archive was set to 3.0.

and the ibm-web-bnd.xmi descriptor was used. E.g.

The problem with this configuration is that for a web-app version 3.0 you have to use ibm-web-bnd.xml instead of xmi. Otherwise the container can not setup the jndi environment correctly which leads to the “javax.naming.ConfigurationException: NamingManager.getURLContext cannot find the factory for this scheme: java”.

Sometime you also get a javax.naming.NamingException telling you that the context java can not be found.

So at least one can say that

  • web-app version <= 2.4 use ibm-web-bnd.xmi
  • web-app version >= 2.5 use ibm-web-bnd.xml

Migrating ibm-web-bnd.xmi to ibm-web-bnd.xml

In my case I had a ibm-web-bnd.xmi and I needed to convert it to the xml descriptor. Thus I thought it would be nice if I could do it via XSLT.

Since my application only used ejbRefBindings and resRefBindings I wrote a xslt script that can convert an ibm-web-bnd.xmi to an ibm-web-bnd.xml

Assuming that you have the following folder setup

xmi-to-xml-folder-setup

Here is some java code that can help you to transform the ibm-web-bnd.xmi to xml – or use some xslt processor of your choice.

If you use the example java code above you can compile it in the directory shown above and execute it with this command line