The purpose of this article is to demonstarate how to modify the SMP 3.0 startup batch file to enable debugging of Agentry java code at run-time.
Prior to SMP 3.0, Agentry java classes could be debugged by adding the following line to the java section of the server's Agentry.ini file:
nonStandardJavaOptions=-Xloggc:gc.log -Xincgc -Xdebug -Xrunjdwp:transport=dt_socket,address=7090,server=y,suspend=n
The address can be set to any free port, and must be echoed in Eclipse when setting up the corresponding Remote Java Application Debug Configuration.
With the release of SMP 3.0, the nonStandardJavaOptions paramter is no longer supported and will be ignored.
From the SMP 3.0 Server machine, right click and edit the properties of the "Start SAP Mobile Platform Server" shortcut that was installed with SMP 3.0. This file is actually called "go.bat".
Add the "-debug port" parameter to the target path, replacing port with your desired debugging port. Save this change to the shortcut.
Restart the SMP 3.0 Server.
If you are using a Linux based server, you can add the command line directives as follows:
at the top of the props.ini:
Save the file and restart the SMP server.
In the Development Environment
In Eclipse, open the Debug perspective.
From the "Run" menu, choose "Debug Configurations".
Add a new "Remote Java Application" and set the port to the same as defined in the "go.bat" -Debug parameter.
Start this debug session and Eclipse will connect to SMP 3.0 and allow breakpoints set in Eclipse to function as the java is executed.
NOTE: For newer Agentry Cloud Edition (ACE) Debugging the following information or steps needs to be done:
Enable Java Debugging on ACE
To enable Java debugging you must first setup your Eclipse environment with the necessary tools. Follow the instructions in the link below to setup your development environment. This is only applicable for the dev ACE environment where the ACE java process is running directly in the tenant account. Java debugging in the other accounts (preview, test, prod) is not supported by customers.
Then use the link below on debugging applications in the cloud and use the Applications Deployed with the Console Client steps.
Set your breakpoints and trigger them by transmitting from the client. If the source does not appear when the breakpoint is hit in the Debug pane find the reference to the file and right click to Edit Source Lookup and specify the Java Projects with the associated source files.
Please note that stepping over, into etc will be slower than debugging on a local server so please be patient.
Blog: Debug JAVA ACE- https://blogs.sap.com/?p=839812
Related Notes:2481728 - How to enable debug mode for SMP 3.0 Agentry Application (This note points to this Wiki article for reference and will be used to be attached in a SAP Incident as the solution - bookmark this Wiki)