Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
----
h1. *Tables of content*

[Remote Debugging OFBiz in

...

Step 1: Run OFBiz in debug mode

...

 Eclipse|#RemoteDebugging]\\
\\
{anchor#RemoteDebugging}\\

h2.  Remote Debugging OFBiz in Eclipse

\\
This is the recommended way for debugging ofbiz. But personnaly (Jacques Le Roux) I use and prefer the second way below : [Running (or debugging) OFBiz in Eclipse|#debuggingInEclipse]

h3. Step 1: Run OFBiz in debug mode

\\
Normally we start OFBiz with the command line
\\
\\  {{%JAVA_HOME%\bin\java \-jar ofbiz.jar

...

}}\\
\\
To start in debug mode use the command line
\\
\\  {{%JAVA_HOME%\bin\java \-Xdebug \-Xnoagent \-Djava.compiler=NONE \-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091 \-jar ofbiz.jar

...

Step 2: Connect to OFBiz with Eclipse as a Debugger

...

}}\\
\\
This changed command line instructs java to run in debug mode listening for a socket connection on port 8091 for a debugger to connect. You can change the port number to any port not otherwise being used.

h3. 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.

...

  • Pick ofbiz for the project
  • Select Standard (Socket Attach) for Connection Type
  • Type localhost for host
  • Type 8091 (or whatever port you chose) for port

...

  • Click Add Projects... (buttons on the right)
  • Select the ofbiz project

...


* 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}} (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.
\\
{noformat}
First created by Jarrod Ribble.

...


{noformat}\\ \\
\\

\---\-

...

{anchor

...

: debuggingInEclipse}

h2. Running (or debugging) 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

...


** Arguments:

...


*** VM arguments: \-Xms(minValue)M \-Xmx(maxValue)

...

M  (typically minValue = 128, maxValue = 512, more is better of course) \-Duser.language=

...

en  
**** 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)

...


\\
{noformat}
Thanks to Peter Goron of Néréides

...


{noformat}\\ \\
\\
\\

\---\-

...

{anchor

...

Browsing Derby Database in Eclipse 

Connecting the database

The Eclipse DTP (Data Tools Project) is quite helpful to inspect database content from within the IDE. As long as you are using the embedded Derby database in OFBiz, you can create a DTP connection as described here. Everything you need comes with OFBiz. Just make sure you have the Data Tools Platform features installed in your Eclipse IDE.

  • In the Data Source Exlorer View, right-click on Databases and choose New ... .

Image Removed

  • Select Derby Embedded Database and click on Next.

Image Removed

  • Enter a name and description. (Note: Both are for your reference only!) Click Finish.

Image Removed

  • Most likely, you will not yet have a Driver Definition for the Derby database available, so the Select a driver dropdown will be empty. Click on the ... button next to it to start creating a driver definition.

Image Removed

  • Choose 10.2 under Derby and click the Add... button.

Image Removed

  • Make sure you choose the Derby Embedded JDBC driver and click OK.

Image Removed

...

: DerbyInEclipse}

h2. Browsing Derby Database in Eclipse 


h3. Connecting the database

The Eclipse DTP (Data Tools Project) is quite helpful to inspect database content from within the IDE. As long as you are using the embedded Derby database in OFBiz, you can create a DTP connection as described here. Everything you need comes with OFBiz. Just make sure you have the Data Tools Platform features installed in your Eclipse IDE.
* In the _Data Source Exlorer View_, right-click on _Databases_ and choose _New ..._ .

!data-source-explorer-view.jpg!
* Select _Derby Embedded Database_ and click on _Next_.

 !new-connection-profile.jpg!
* Enter a name and description. (Note: Both are for your reference only\!) Click Finish.

 !create-connection-profile.jpg!
* Most likely, you will not yet have a Driver Definition for the Derby database available, so the Select a driver dropdown will be empty. Click on the ... button next to it to start creating a driver definition.

 !derby-embeeded-database-1.jpg!
* Choose _10.2_ under _Derby_ and click the _Add..._ button.

 !driver-definitions-1.jpg!
* Make sure you choose the _Derby_ _{+}Embedded{+}_ _JDBC driver_ and click _OK_.

!new-driver-definition.jpg!
* The template expects the driver to be in a file called derby.jar. Select that line in the _Driver File(s)_ listbox and click on _Edit Jar/Zip_ to specify the actual location of the JAR file. You will find this in your workspace as framework/entity/lib/jdbc/derby-10.2.2.0.jar. When done, click OK

...

Image Removed

  • You should be back in the Driver and Connection Details. Fill in the parameters as you can see them here. Note: For Database location, adapt to your workspace location. There is no way to use a variable in this path, unfortunately. Username and password are ofbiz/ofbiz by default. For convenience, in a development environment, it should be acceptable to save the password with the connection. Make sure that Create database (if required) is unchecked, as this does not make sense in this context.

Important: This is not the place to decide that you'd like your Derby DB in a different location for OFBiz as OFBiz itself does not use these settings. If you would like to have your database outside of the workspace, take a look at the entityengine.xml config file and read the Entity Engine Configuration Guide to learn how to switch databases.

Click on Test Connection to make sure your settings allow you to successfully connect to the database.

Image Removed

  • You should now be able to browse the database content of OFBiz inside Eclipse.

...

.

 !edit-driver-definition.jpg!
* You should be back in the Driver and Connection Details. Fill in the parameters as you can see them here. Note: For Database location, adapt to your workspace location. There is no way to use a variable in this path, unfortunately. Username and password are ofbiz/ofbiz by default. For convenience, in a development environment, it should be acceptable to save the password with the connection. Make sure that Create database (if required) is unchecked, as this does not make sense in this context.

*Important:* This is not the place to decide that you'd like your Derby DB in a different location for OFBiz as OFBiz itself does not use these settings. If you would like to have your database outside of the workspace, take a look at the entityengine.xml config file and read the Entity Engine Configuration Guide to learn how to switch databases.

Click on Test Connection to make sure your settings allow you to successfully connect to the database.

!derby-embeeded-database-2.jpg!
* You should now be able to browse the database content of OFBiz inside Eclipse.

 !data-source-explorer-view-done.jpg!