title | category | tags |
---|---|---|
Debug Java Actions |
Monitoring & Troubleshooting |
The Mendix Modeler has a built-in debugger to solve errors on the microflow level. A microflow can be extended with custom Java actions, but because these actions are text-based, they can only be checked on compile errors. If you run into an error in any of the Java actions, you can easily debug them by utilizing the debugger of Eclipse.
This how-to will teach you how to do the following:
- Set breakpoints
- Debug in Eclipe
Before starting this how-to, make sure you have completed the following prerequisites:
- Install Eclipse
- Add a Java action and open the project in Eclipse
- Read How to Extend Your Application with Custom Java
- Deploy the application for Eclipse by selecting Deploy for Eclipse from the project menu in the Modeler (you should redo this every time you make changes in the Modeler):
-
Open Eclipse and locate the project in the Package Explorer.
-
Place the cursor on the line that needs debugging, hold down Ctrl+Shift, and press B to enable a breakpoint. A blue dot in front of the line will appear:
{{% alert type="info" %}}
You can also use Ctrl+Shift+B to disable a breakpoint.
{{% /alert %}}
-
Select the project root node in the package explorer and click the debug icon in the Eclipse toolbar:
The application will now be started with Eclipse attached as debugger.
-
As soon as the deployment process is ready, open the application in your browser and trigger the Java action:
- As an end-user of the application, you will see a progress bar on your application
- As a developer, you will see the Eclipse icon flashing on the Windows task bar
-
Open Eclipse. You should now see the "debug" perspective of Eclipse.
-
Click Step into (or press F5) or Step over (or press F6) to move on the next step in the microflow:
{{% alert type="warning" %}}
With debugger options, the difference between "Step into" and "Step over" is only noticeable if you run into a function call. "Step into" means that the debugger steps into the function, and "Step over" just moves the debugger to the next line in the same Java action. With "Step Return" (pressing F7), you can instruct the debugger to leave the function; this is basically the opposite of "Step Into." Clicking "Resume" (pressing F8) instructs the debugger to continue until it reaches another breakpoint.
{{% /alert %}}
-
Place your cursor on any of the variables in the Java action to see its value in a pop-up window:
- How to Find the Root Cause of Runtime Errors
- How to Clear Warning Messages in Mendix
- How to Test Web Services Using SoapUI
- How to Monitor Mendix Using JMX
- How to Debug Java Actions Remotely
- How to Log Levels
- How to Debug Microflows
- How to Common Mendix SSO Errors
- How to Debug Microflows Remotely
- Java Actions