Skip to Content
Author's profile photo Tobias Hofmann

Debug a portal application

Debugging an application comes down to see what is going on during execution of the application. One way of debugging is to log specific messages to a file. To get a detailed analysis of the program flow you set breakpoints. These breakpoints are set in your source code and are instructions of the Java VM to stop execution when it hits a breakpoint. After the execution stopped you can see the current values of variables. What is outlined here is for SAP Portal 7.x, but the overall process should be the same for the 7.3 portal.

Before you can start debugging a portal application (PAR) you have to enable the debug option on your portal server. This means that you will enable a specific debug port to which your NWDS will connect. To actually debug the portal application you’ll use NWDS. This implies that you rarely will activate and execute a debug session in your productive portal environment. If you have debug a PAR that already is in production, something is wrong with how you release software. The debug port is activated using the configtool. You set the debug port to an arbitrary value, just make sure that the port is free.

/wp-content/uploads/2012/05/debugpar1_105115.jpg

If you cannot open the port (firewall) or your Basis team won’t allow it: sorry, no workaround available. In the portal application, set breakpoints where you want the Java VM to stop execution so you can take a closer look at the VM environment.

/wp-content/uploads/2012/05/debugpar2_105200.jpg

You can add additional properties to the breakpoint, but basically a simple breakpoint is all you’ll need. This will give you the nice little blue point at the left side of your code:

/wp-content/uploads/2012/05/debugpar3_105201.jpg

This will instruct the VM to stop every time the array a gets a value assigned. Next step is to deploy the PAR. Make sure that you select the option: “Include the source code of the portal application”. If not, the debug won’t work.

/wp-content/uploads/2012/05/debugpar4_105202.jpg

To actually start the debug session you create a remote java application configuration:

/wp-content/uploads/2012/05/debugpar5_105215.jpg

/wp-content/uploads/2012/05/debugpar6_105216.jpg

Specify the portal project, the server and debug port (the one you gave in configtool). After clicking on debug, NWDS will connect to the Java VM and already present you with some nice information of the VM. When you now execute the PAR, the Java VM will stop the application where you have set the breakpoint.

/wp-content/uploads/2012/05/debugpar7_105217.jpg

You can start exploring the current state of your application. The variables are shown with their current values:

/wp-content/uploads/2012/05/debugpar8_105221.jpg

To gain a deeper understanding of the environment of the PAR, you can also look at the request object and find out variables and their values:

/wp-content/uploads/2012/05/debugpar9_105222.jpg

Resuming execution and the values are being updates:

/wp-content/uploads/2012/05/debugpar10_105223.jpg

Happy debugging!

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Have a strange issue - I can debug all java/portal applications locally (localhost NW 7.4 setup).

      I can debug stand alone java applications running on our sandbox NW 7.4 server, so I know the port is open and right, but for some reason, when I'm connected to our sandbox server and try to debug an abstractportalcomponent, the debug point is never hit.  I can't figure out what is different...  same breakpoint pointing to localhost 50021 - caught.  Disconnect debugger from localhost, relaunch connected to sandbox, and the same breakpoint in the same project is never hit.  Tried with many different portal applications and stand alone java applications.  The java ones work, the portal components don't.  Is there a setting which can make portal applications only not available for debug?

      Author's profile photo Tobias Hofmann
      Tobias Hofmann
      Blog Post Author

      I have no idea why you cannot debug remotly portal applications. It must be a server/portal configuration, but unfortunately I cannot help you with this one.

      Maybe you can post it in the portal development space or as a last resort open an OSS message.