About Business Logic Debugging¶
Backendless custom business logic can be debugged locally on the developer's computer while it is plugged into the Backendless Cloud service. This means your business logic code can be invoked through the API accessible via Backendless Cloud while the custom code runs on your computer. To develop and debug custom business logic developers must use CodeRunner™ SDK.
Important
If you develop API services, you should download the CodeRunner SDK from the Backendless website. If you develop API event handlers and/or timers and used the Business Logic code generation built into Backendless console, CodeRunner™ is already included into the generated ZIP file.
The CodeRunner™ distribution has the following directory structure:
- The
/classes
folder is the default location where CodeRunner™ searches for any classes with custom business logic (services, event handlers and timers). For convenience, set the/classes
directory as the path for the compilation output for the classes with custom business logic. - The
/libs
folder must be used for any 3rd party libraries (.jar files) the custom business logic depends on.
To run CodeRunner™, open a command prompt window and change the current directory to the bin
directory from the CodeRunner™ distribution.
Run the following command from the /bin
directory to start CodeRunner™ in the local debug mode:
Linux:
./CodeRunner.sh
Windows:
CodeRunner.bat
Once coderunner starts, it produces the following output:
your-comp-name:bin username$ ./CodeRunner.sh
Listening for transport dt_socket at address: 5005
[INFO] CodeRunner(tm) Backendless Debugging Utility
[INFO] Copyright(C) 2017 Backendless Corp. All rights reserved.
[INFO] Version: 4.0.0 Build date: 20160323-0551
[INFO] CodeRunner session is running for 2 hours and will be terminated on 14:32:34.194[UTC]
[INFO] Registering runner on: 'https://api.backendless.com' with version 'v1'
[INFO] Application ID: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
[INFO] Secret key: 'ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ'
[INFO] Runner successfully registered
[INFO] Parsing event model...
[INFO] Build successfully: 3 handlers, 2 timers
[INFO] Deploying model to server, and starting debug...
[INFO] Model successfully deployed.
[INFO] Waiting for events...
In some cases CodeRunner™ may report the following messages:
[INFO] JDK from "JAVA_HOME" - not set.
[INFO] JRE from "JRE_HOME" - not set.
[WARN] WARNING! It appears you do not have JAVA_HOME and JRE_HOME environment variables set.
This is not necessarily a problem, but it may lead to errors during CodeRunner execution.
If you experience problems related to security policy permissions, the JAR utility or others,
please try setting up the JAVA_HOME environment variable by pointing it to the root directory
of your JDK location (must be version 1.8 or higher).
If you see the message and CodeRunner™ subsequently reports runtime errors, it is required to set the JAVA_HOME
property which must point to the root of the JDK installation.