Running Apache Solr on JBoss

Off late, I’ve been doing a lot of development with Railo running on JBoss. So naturally, I wanted to plug in Apache Solr (which now ships with ColdFusion 9) into my JBoss instance running Railo.

What I thought would be straight-forward took a bit to figure out. The issue comes when you have to setup the solr.home property. The Apache Solr wiki suggests putting an <env-entry> node in the web.xml. However, if you do that, the XML does not validate as “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”. JBoss 5 is a little particular about web.xml validating properly — which is a good thing!

So the trick to declare Solr home variable is to do this:

Add the following to conf/jboss-service.xml

<!-- For Apache Solr -->
<mbean code="org.jboss.naming.JNDIBindingServiceMgr" name="jboss.tests:service=JNDIBindingServiceMgr">
      <attribute name="BindingsConfig" serialDataType="jbxb">
         <jndi:bindings xmlns:xs="" xmlns:jndi="urn:jboss:jndi-binding-service:1.0" xs:schemaLocation="urn:jboss:jndi-binding-service:1.0resource:jndi-binding-service_1_0.xsd">
            <jndi:binding name="solr/home">
                <jndi:value type="java.lang.String">FILESYSTEM_PATH_TO_SOLR_HOME</jndi:value>

Replace FILESYSTEM_PATH_TO_SOLR_HOME in the above node to the actual physical filesystem path where Solr home for your application lives, e.g., in my case it was: /Users/indy/solr/

Add the following node to the application specific WEB-INF/web.xml:


And finally create a WEB-INF/jboss-web.xml file (if it already does not exist for your web application) and add the following content to it:


Once done, browse to your app: http://yourserver:port/solr/ and you should see Apache Solr running. Obviously you need to make sure that the Solr home directory contains the appropriate XML descriptors for Solr configuration.