Access to add and change pages is restricted. See:

Pre Gradle version

This page documents the usage with Gradle, the pre-Gradle documentation is here: Running and Debugging OFBiz in Eclipse

Table of contents

Be sure Eclipse is ready

Before any interaction with OFBiz in Eclipse be sure to run "gradlew eclipse". This generate the information Eclipse needs about the OFBiz project.

Run OFBiz in debug mode and debug in Eclipse

Step 1: Run OFBiz in debug mode

Normally we start OFBiz with the command line

  gradlew ofbiz

To start in debug mode use the command line

R17.12 and R18.12

  gradlew ofbizDebug

Trunk and after R18.12

  gradlew ofbiz --debug-jvm

This run in debug mode listening for a socket connection on port 5005 for a debugger to connect. So unlike with Ant you have to connect a Debugger at this port for OFBiz to continue.

Step 2: Connect to OFBiz with Eclipse as a Debugger

Before connecting you have to create a new debug configuration.

  • In Eclipse choose Run->Debug... from the menu. A Debug window should pop up.
  • Select Remote Java Application from the tree on the left.
  • Click New (button on the bottom left).
  • Type a name at the top (OFBiz, perhaps?)
  • On the Connect tab
    • Pick ofbiz for the project
    • Select Standard (Socket Attach) for Connection Type
    • Type localhost for host
    • Type 5005
  • On the Source tab
    • Click Add Projects... (buttons on the right)
    • Select the ofbiz project
  • Click Apply If you have OFBiz running debug (Step 1 above) you can start debugging by clicking Debug (on the bottom) now.
    You know that you are connected when you see a start/stop button in the debug perspective of Eclipse.

Debugging (or running) OFBiz inside Eclipse

  • Select OFBiz project, right-click on it -> Run As -> Run ... (alike for Debug)
  • Select Java Application and click on New
  • Set Run configuration name to OFBiz
    • Main tab:
      • Project: OFBiz
      • Main class: org.ofbiz.base.start.Start
      • If you need it (to trace a framework bug in the 1st loaded class) you may use the "Stop in Main" Option
    • Arguments:
      • VM arguments: -Xms(minValue)M -Xmx(maxValue)M  (typically minValue = 128, maxValue = 1024, more is better of course)
        • In some case (Suse  SL 10.1 at least) it's better to not define any VM arguments but let the defaults values.
      • Working directory: Use default working directory
    • Classpath
      • Bootstrap Entries: JRE System Library
      • User Entries: build/libs/ofbiz.jar from OFBiz project
        • Don't forget to remove the entry "ofbiz (default classpath)" else you may have a message "Can't find bundle for base name cache, locale ..."
    • Source tab
      • Click Add Projects... (buttons on the right)
      • Select the ofbiz project
    • Environment
      • Add environment variable LC_ALL=C (Optional, Linux only)
  • Click on Apply and Run (or Debug)

Note that when doing development work, you will have to stop OFBiz. Because this method treats OFBiz as a plain Java. You don't have any automatic classloading as you might be used to when using Eclipse-WTP and developing webapps.

  • No labels