Thursday, December 7, 2006

ofbiz and eclipse

There are four basic things you might like to do in eclipse: manage svn tasks, Run Ant builds, start and stop ofbiz, and debug java files. All of these are within your reach, but the number of options might send you back to typing "startofbiz" at the command line. Ofbiz has a wiki entry about using eclipse and that is a good starting point, even though it doesn't address all the painful hassles you may encounter.

  1. It is really nice to have svn commands right there in your eclipse file navigator. Here is how to install subclipse. Visit to get the location of the update site and then open help --> software updates-->find and install --> search for new features --> new remote site --> enter name and http address and follow steps.
    1. which version? I have eclipse 3.2 and I installed subclipse 1.1.x and had no problems
    2. how to connect to an existing project repository? This couldn't be simpler. Right click in navigation panel. Select import from context menu. Choose "Checkout projects from svn and enter the svn url in the space provided

  2. ANT. Really all you need to do with ANT is load your project's build.xml file into eclipse's excellent ANT tool and run your ANT target from there.
    1. open Ant view
    2. browse to the build.xml file for ofbiz
    3. click the green arrow to run the default target
    4. double-click run-install or run install seed to set up the default passwords and other initialization stuff
    5. browse to the build.xml file for your project
    6. click the green arrow to run the default target for your project
  3. starting and stopping the whole damn ofbiz server from within eclipse. Follow the directions in the wiki and note that:
    1. all the classpath settings in your project's build path that allow you to EDIT your project in eclipse need to now show up in the project's run path to allow you to RUN your project in eclipse. Classpath errors can either mean missing libraries or they can mean conflicting libraries.
    2. Your search - ofbiz blooooody entityresolver2 - did not match any documents. Errors like "java.lang.NoClassDefFoundError: org/xml/sax/ext/EntityResolver2" could mean eclipse is finding a jar file with a package that is the same as the one that the missing class is really in. It is finding the wrong jar file FIRST. I got around my issue by changing the order of library imports in the classpath window.
    3. I had to copy RemoteDispatcherImpl_Stub.class from \ofbiz\framework\service\build\classes\org\ofbiz\service\rmi TO \ofbiz\bin\org\ofbiz\service\rmi
  4. debugging then comes fairly naturally after getting it running inside eclipse. You can only debug java files. I would love to know a way to debug minilang, bsh and ftl.