Debugging Java applications on SAP PI/PO
Below are the steps to debug any Java application on SAP PI/PO – they are generic for SAP AS Java server .It can be used to debug Java mappings, Java proxy calls in PI etc.
-Log on to SAP management console and click on developer trace. There is documentation of SAP AS Java ports here.
However, it’s easiest to just look at the Developer Trace and get the port number. You may need to ask Basis to supply this information as it requires access to SAP management console.
– In this case, the debugging port is 50021 .
– From SAP management console, enable debugging.
-The port number can also be verified by looking at debugging “Switched on (50021)” column.
– To debug the application, create a debug configuration in NWDS. It can be selected from Run -> Debug Configurations.
Use ‘Remote Java Application’ as the application type.
-Create the configuration specifying the project name and click on Debug.
– This launches the debug mode.Confirm to use the debug mode.
– We’re ready to start debugging the Java code.
The code can be any Java object :
– I tested with SAP PI Java mapping – in this case you have to let the map execute by processing a message.
– This example is a SAP Java proxy I was testing and had issues in figuring out the error. Hence, I created a simple Servlet which fires a message.
and the Servlet can be executed allowing us to debug any J2EE application component.
I hope it’s useful for SAP PI developers as especially with single Java stack, there are going to be more Java objects created and being able to debug is efficient.
Furthermore, in PI Java mappings sometimes we need the actual data and environment to test the application and making a dummy call from main to call transform / execute can’t doesn’t provide the information. An instance of this could be a JDBC call to read a PI table.