Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removes now useless part (less to maintain)

 

Info
titlePre Gradle version

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

Info
titlePre Gradle version

page

Info
titlePre Gradle version
 
Info
titlePre Gradle version

 

...

Tables of content

  1. Remote Debugging OFBiz in Eclipse
  2. Debugging (or running) OFBiz in Eclipse
  3. Debugging (or running) OFBiz in Eclipse with hot replacement of classes
  4. Browsing Derby Database in Eclipse

...

anchor RemoteDebuggingRemoteDebugging

1.

...

Debugging OFBiz in Eclipse

This is the official recommended way for debugging OFBiz. It's fine. The second method below Debugging (or running) OFBiz in Eclipse is convenient is really helpful when it comes to debug the framework java code. When someone has screwed up the framework java code (trunk only) and you can't load OFBiz. Then it's an easy way to debug OFBiz using inside debugging. Though using the remote debugging technique, you may also suspend the JVM through the command line options at start up. Effectively the JVM boots, stops and waits for a debugger to connect and then it continues so you can still use remote debugging. Just put suspend=y in the start options alongside the socket and ports settings (thanks Ray)Before we also used to debug or run OFBiz inside Eclipse, but this is no longer documented here as long as the "Can't find bundle for base name cache, locale en" bug is not fixed.

Step 1: Run OFBiz in debug mode

Normally we start OFBiz with the command line

Code Block
  %JAVA_HOME%\bin\java -jargradlew ofbiz.jar

To start in debug mode use the command line

Code Block
  %JAVA_HOME%\bin\java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091 -jar ofbiz.jar
gradlew ofbizDebug

This This changed command line instructs java to run in debug mode listening for a socket connection on port 8091 5005 for a debugger to connect. You can change the port number to any port not otherwise being used.There is an ant task that you could use to start Ofbiz with the debug settings above.

...

...

  ./ant run-debug

Step 2: Connect to OFBiz with Eclipse as a Debugger

...

  • 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 8091 5005 (or whatever port you chose) for port
  • 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.

The above section was first created by Jarrod Ribble

...

 

...

 

...

2. Debugging (or running) OFBiz in 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 = 512, 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: 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, run an Ant build and re-start. Because this method treats OFBiz as a plain Java up, you don't have any automatic classloading as you might be used to when using Eclipse-WTP and developing webapps.

The above section thanks to Peter Goron

...

3. Debugging (or running) OFBiz in Eclipse with hot replacement of classes

  • 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.start
    • Main tab:
      • Project: OFBiz
      • Main class: org.ofbiz.base.start.Start
    • Arguments:
      • Program Arguments: -start
      • VM arguments: -DDEBUG=true -Xms(minValue)M -Xmx(maxValue)M  (typically minValue = 128, maxValue = 512)
    • Classpath
      • User Entries: Add the framework/base/config directory
  • Click on Apply
  • add the following lines to the /ofbiz/framework/entity/src/META-INF/services/org.ofbiz.base.conversion.ConverterLoader unless your ofbiz svn release is greater or equal to r1308085. see https://issues.apache.org/jira/browse/OFBIZ-4777
    • org.ofbiz.base.conversion.BooleanConverters
    • org.ofbiz.base.conversion.CollectionConverters
    • org.ofbiz.base.conversion.DateTimeConverters
    • org.ofbiz.base.conversion.JSONConverters
    • org.ofbiz.base.conversion.MiscConverters
    • org.ofbiz.base.conversion.NetConverters
    • org.ofbiz.base.conversion.NumberConverters
  • add the build-eclipse target in the main build.xml as
    <target name="build-eclipse" depends="build">
    <delete>
    <fileset dir="${basedir}">
    <include name="**/build/lib/ofbiz-*.jar"/>
    <exclude name="**/ofbiz-minerva.jar"/>
    </fileset>
    </delete>
    </target>
  • run ant build-eclipse at the OFBiz directory
  • launch OFBiz.start with the debugger launcher

In case of MissingResourceException error see Thim Anneessens's comment at bottom

AnchorDerbyInEclipseDerbyInEclipse

4. Browsing Derby Database in Eclipse

...