Skip to Content
In this weblog I want to give you a short introduction how to set up debugging for portal applications. To be more precise, I’m talking about java coding with the Netweaver Developer Studio (NDS).

As a prerequisite, your portal server has to run in debug mode. If that’s not the case, open your configtool, click on the server node and apply the settings as in the screenshot below:

image

Then you have to restart the server process. After restart you should see in the J2EE Engine view of your Netweaver Studio that Debug Mode is “ON”.

image

Ok, your server is now ready to debug, all what we need now is a portal application project in the NDS. Fortunately, I’ve already prepared one. It took me weeks of heavy effort to present you this highly-sophisticated, well-designed, hardcore-java portal application project which consists of a single component named FooComponent (applause!).
In the source code, you’re able to set breakpoints by double-clicking at the left side next to your code line. You also can use the right mouse button to use the context menu.
When debugging, the execution of your component will stop right before the line of your breakpoints.

image

After setting the breakpoints you can start your debugging. Click on “Run” -> “Debug…”
In the debug window’s configuration tree, right click on the configuration “Remote Java Application” and choose “New”.
Your Project should be automatically selected, if not, click “Browse” and select your project.
In the connection properties enter your “Host” and “Port”. The port is the same you specfied in the config tool. For standard portals, it’s 50021.

image

Now switch to the tab “Common” and change the dropdown box to “Enterprise Portal”.

image

You’re done. Click “Apply” to save your changes or “Debug” if you want to start immediately.
If you’ve started debugging, switch to the “Debug” perspective and have a look at the “Debug” view. You should see your component and a lot of running threads.
Now invoke your component in your browser window with the Component Inspector or with an iView. The execution should stop at your first breakpoint.

image

In the “Debug” perspective there also is a view called “Variables” where you can see the values of all variables including the request object. See the screenshot below and the value of my String object “debugTest”.
For going to the next breakpoint, click the “Resume” icon on your “Debug” view or press F8.

image

To stop debugging, right click on your server node in the “Debug” view and select “Disconnect”.

image

There are some more features in the debug mode, but you can consult the documentation of your NDS for getting into details.

Happy debugging!

Cheers,Karsten

To report this post you need to login first.

20 Comments

You must be Logged on to comment or reply to a post.

  1. Dagfinn Parnas
    Excellent blog.

    But while I was testing it I discovered something weird; I wasn’t able to debug JSPDynpages. I had no problems with AbstractPortalComponents or Dynpages, but for some reason the break points I set in the JSPDynpage were never reached(set them in doInitialization and doProcessBeforeOutput, and called the component from preview function). If I set some breakpoints in a bean method which was called from the jsp, I got it, but none of the points in the actual JSPDynpage were reached(I know it was the right class, and the debug points showed up in one of the debug views). I thought it might be the fact that it is by default an inner static class, but even if I moved it out and made it non-static it wouldn’t work. Has anyone else experienced this?

    Ps running on NetWeaver SP9 SR1

    (0) 
    1. Karsten Geiseler Post author
      Hi Dagfinn,

      I just tried it and it works for me.
      I’ve set a breakpoint in the doInitialization() method of my dynpage (which is a static inner class as generated by the wizard).
      And the application stops…

      I use EP 6.0.12.0.0 and NDS 2.0.12 and I don’t use the preview function of the studio (because firefox is my default browser :-))

      Unfortunately, I don’t have a SP9 version to check it.

      Regards, Karsten

      (0) 
    2. Kashif Ahmad
      Good Blog
      But there is a problem with me. I am a new user on SAP Portals. I set the server parameters as shown in the snapshots. But when I opened the Netweaver, it was still showing me the “Debug Mode Off”. When i tried to set the problem from the preferences –> J2E Engine by selecting remote installation, it gave me the error “No server was defined under \\sapmnt\.. Configure your server as Remote host”… I tried a lot but could not get through this problem.
      I have a portal installation having a URL “http://kashruq:50000/“. Earlier I had set the IP Address for my network card as 10.10.1.10 but later removed it and set the etc\hosts file accordingly. The J2EE server is running fine but I am unble to debug my J2EE applications. Any body help me ?
      (0) 
      1. Karsten Geiseler Post author
        Hi Kashif,

        better open a thread in the Portal Content Development Forum in order to get help. Maybe this is the wrong place here to chat.

        Regards, Karsten

        (0) 
  2. Karthick Eswaran
    Hi,
    when i try to give my host name and port and if i click debug it says “Failed to connect to remote VM”.The server is running on debug mode itself.
    And one more thing where can i find J2EE config tool?

    Regards,
    Karthick

    (0) 
      1. Jamie Chuasiripattana
        Hello Karsten,

        I followed the instructions on your weblog however, when I restarted the server using Visual Admin tool.  The server still stating ‘debuggable = No’ and ‘debugmode = off’.  Can you please guide me as to why the settings in the config tool is not taking effect?

        Thank you,

        Jamie.

        (0) 
  3. Jens Runge
    Hi, in configtool the settings “Debuggable” and “Enabled debug mode” are set, in NWDS I see Debug mode = ON for the server. But if I click debug in NWDS I get “Failed to connect to remote VM”. I tried the port 50021 (as suggested) and 1024 (default setting, as suggested in another thread “Debugging in PDK”). Neither of them works.

    Regards,
    Jens

    (0) 
      1. Karsten Geiseler Post author
        Maybe you have configured the wrong port, the port is blocked or another person is debugging.
        If all points are correct, no firewall is blocking and the connection is still blocked, try restarting the server node.
        try a telnet connection from the client pc to the debug port of the server or have a look at netstat on the server.
        Cheers, Karsten
        (0) 
  4. lew hauchee
    Hi Karstern,

    I am wondering why in Debug properties – Common tab, we have to choose “Enterprise Portal” at the Debug mode drop down list?

    This setting make NWDS switch to Enterprise Portal Perspective automatically during my debuging process(whenever i press F6 or F8). This is annoying where I have to manually switch it back to Debug Perspective in order to continue my debugging.

    What is the purpose of the Debug mode setting?

    Regards,
    HauChee

    (0) 
    1. Karsten Geiseler Post author
      Hi HauChee,

      maybe you got me wrong. Of course you don’t HAVE to activate this setting. It works just as it says, “Perspective to switch to or open when launched in”.

      If you are just stepping through an application, it is more comfortable to not use that feature.

      regards, Karsten

      (0) 
  5. Chetan Deshpande
    Hi,
        i have tried the steps you mentioned for debugging remotely 2-3 times. steps are fine, bt after setting everything , when i click debug, execution doesnt stop just before the postion of first break-point. It jsut behave like running a progarm, not the debugging.can you help me out what can be the reason for this unusal behaviour while debugging, is it that i have missed something or done wrong?
    (0) 
  6. ws ws
    I am working in a workgroup team . This option is very interested but only one member of the team can debug the application. If one person launched the debug in NWDS the others member can’t do it because the connection is rejected. You can debug when this person finish his/her debug. My question is:

    Is there any way to debug more than 1 person at the same time?

    (0) 
  7. During the migration process problems have been reported for this blog. The blog content may look corrupt due to not supported HTML code on this platform. Please adjust the blog content manually before moving it to an official community.
    (0) 

Leave a Reply