Monday, March 10, 2008

How to Hot Deploy your application in Ofbiz

Ofbiz uses embedded tomcat container as a web/application server. Ofbiz comes with hot-deploy directory exactly for that purpose - to be able to hot-deploy your application. This comes in handy especially during development, since Ofbiz startup takes a while, restarting several times during the development can be painful.

hot-deploy in Ofbiz doesnt work out of the box, there are a couple of minor config changes that you need to do before you can use it.

  1. Copy you Ofbiz application (web application) under hot-deploy directory. Make sure all the directory structure of your ofbiz application is correct.
  2. Create (or copy from other ofbiz applications) component-load.xml file and add your applications load-component element tag
  3. In your ofbiz_home/framework/base/config/ofbiz-containers.xml file change the property setting app-contact-reloadable to true e.g. <property name="apps-context-reloadable" value="false"/>
  4. Restart ofbiz for this change to take effect.
  5. To test if its working, modify one of the java files of your application and recompile it. You will see messages on your console and/or log file indicating the web app context being reloaded.
    Important: I use build.xml in my application to copy my application jar file under my applications ofbiz_home/hot-deploy/myapp/webapp/myapp/WEB-INF/lib directory. I have not tried choosing a different deploy location so not sure if it will work.

No comments: