Debugging Portal Applications



Similar documents
Download and Install Crystal Reports for Eclipse via the Eclipse Software Update Manager

How to Set Up an Authorization for a Business Partner in Customer Relationship Management (CRM) Internet Sales: Sample Case

Configuring Distribution List in Compliant User Provisioning

How To Configure MDM to Work with Oracle ASM-Based Products

SAP GRC Access Control: Background jobs for risk analysis and remediation (formerly Virsa Compliance Calibrator)

Analyzing Sales Data for Choosing Forecast Strategies

How to configure BusinessObjects Enterprise with Citrix Presentation Server 4.0

Posting Messages into XI

Roster Configuration (Payroll) in SAP ECC 6.0 Tips & Tricks

Methodology to Implement SAP Process Integration

Developing Applications for Integration between PI and SAP ERP in Different Network Domains or Landscapes

Utilities for downloading and uploading OO ABAP classes in XML format

Performance Best Practices Guide for SAP NetWeaver Portal 7.3

Backup & Restore with SAP BPC (MS SQL 2005)

prioritize XI messages on integration server

How to Configure and Trouble Shoot Notification for Process Control 2.5

Extract Archived Data from SAP ERP

Implementing Outlook Integration for SAP Business One

CREATING A PURCHASE ORDER STORE RECORD WEB SERVICE

3 rd party Service Desk interface

SAP Master Data Governance- Hiding fields in the change request User Interface

Maintaining Different Addresses and Ids for a Business Partner via CRM Web UI

SAP NetWeaver MDM 5.5 SP3 SAP Portal iviews Installation & Configuration. Ron Hendrickx SAP NetWeaver RIG Americas Foundation Team

Ronald Bueck SBO Product Definition

Budget Control by Cost Center

Integrate Third Party Collaboration Tools in the SAP NetWeaver Portal. SAP NetWeaver Product Management

Business One in Action - How can we post bank fees and charges while posting Incoming or Outgoing Payment transactions?

Process Archiving using NetWeaver Business Process Management

NetWeaver Business Client (NWBC) for Incentives and Commissions Management (ICM)

Integrating Easy Document Management System in SAP DMS

How to Configure Access Control for Exchange using PowerShell Cmdlets A Step-by-Step guide

E-Recruiting Job Board Integration using XI

How To... Call BEx Web Applications from SAP BusinessObjects Dashboards (Xcelsius) and vice versa

R/3 and J2EE Setup for Digital Signature on Form 16 in HR Systems

Table of Contents. How to Find Database Index usage per ABAP Report and Creating an Index

User Experience in Custom Apps

Siteco Relies on SDN for its SAP CRM 5.0 Upgrade

How to Create Web Dynpro-Based iviews. Based on SAP NetWeaver 04 Stack 09. Jochen Guertler

TM111. ERP Integration for Order Management (Shipper Specific) COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

Data Archiving in CRM: a Brief Overview

Sales Rush Sales Order Processing S01- Lean Baseline Package. SAP Lean Baseline Package Version: V1.500 Country: UK Language: EN Date: February 2006

Alert Notification in SAP Supply Network Collaboration. SNC Extension Guide

Problems with your Data Model in SAP NetWeaver MDM Do s and Don ts

USDL XG WP3 SAP use case. Kay Kadner

How To... Integrate Custom Formulas into the Formula Builder

Enterprise Software - Applications, Technologies and Programming

Understanding HR Schema and PCR with an Example

Third Party Digital Asset Management Integration

How To Balance In Sap Bw

Enabling Full-Text Search for Business Objects in mysap ERP

How to Create a Support Message in SAP Service Marketplace

UI Framework Logo exchange without skin copy. SAP Enhancement Package 1 for SAP CRM 7.0

SAPFIN. Overview of SAP ERP Financials COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

HR400 SAP ERP HCM Payroll Configuration

ARCHIVING OF IDOCS IN SAP

Integration of Universal Worklist into Microsoft Office SharePoint

How to Schedule Report Execution and Mailing

Business Requirements... 3 Analytics... 3 Typical Use Cases... 8 Related Content... 9 Copyright... 10

Single Sign-On between SAP Portal and SuccessFactors

Log Analysis Tool for SAP NetWeaver AS Java

Integration of SAP Netweaver User Management with LDAP

OData in a Nutshell. August 2011 INTERNAL

Data Source Enhancement Using User Exit

Variable Exit in Sap BI How to Start

How To Use the ESR Eclipse Tool with the Enterprise Service Repository

Intelligent Business Operations Chapter 1: Overview & Strategy

DBA Cockpit for Oracle

SAP Business ByDesign Reference Systems. Scenario Outline. SAP ERP Integration Scenarios

UI Framework Task Based User Interface. SAP Enhancement Package 1 for SAP CRM 7.0

SAP Central Process Scheduling (CPS) 8.0 by Redwood

Sending Additional Files from SAP Netweaver PI to third Party System

Accounts Receivable. SAP Best Practices

How to Add an Attribute to a Case, Record and a Document in NW Folder Management (ex-records Management)

SAP NetWeaver BRM 7.3

UI Framework Simple Search in CRM WebClient based on NetWeaver Enterprise Search (ABAP) SAP Enhancement Package 1 for SAP CRM 7.0

Installation Guide Customized Installation of SQL Server 2008 for an SAP System with SQL4SAP.VBS

Portfolio and Project Management 5.0: Excel Integration for Financial and Capacity Planning

Integration of SAP central user administration with Microsoft Active Directory

AC200. Basics of Customizing for Financial Accounting: General Ledger, Accounts Receivable, Accounts Payable COURSE OUTLINE

Xcelsius Dashboards on SAP NetWaver BW Implementation Best Practices

K in Identify the differences between the universe design tool and the information design tool

Monitoring and Management of Landscapes with SAP NetWeaver Administrator. Dieter Krieger, SAP AG

Consume an External Web Service in a Nutshell with good old ABAP

RUN BETTER Become a Best-Run Business with Remote Support Platform for SAP Business One

How To... Migrate Custom Portal Applications to SAP NetWeaver 7.3

Collaboration Technology Support Center - Microsoft - Collaboration Brief

Secure MobiLink Synchronization using Microsoft IIS and the MobiLink Redirector

SAP Service Tools for Performance Analysis

Sample Universe on Microsoft OLAP Cube

Compliant, Business-Driven Identity Management using. SAP NetWeaver Identity Management and SBOP Access Control. February 2010

Using SAP Logon Tickets for Single Sign on to Microsoft based web applications

Configuring Single Sign-on for SAP HANA

Global Transport Label - General Motors -

Workflow extended notifications

mysap ERP Talent Management Dr. Christian Acosta-Flamma

Matthias Steiner SAP. SAP HANA Cloud Platform A guided tour

SAP Sales and Operations Planning Software Product (xsop)

SAP CCMS Monitors Microsoft Windows Eventlog

How to Configure and Trouble Shoot Workflow for Process Control 2.5

SOP through Long Term Planning Transfer to LIS/PIS/Capacity. SAP Best Practices

Transcription:

Debugging Portal Applications Applies to: SAP NetWeaver Portal, and developers of portal applications Summary NetWeaver Developer Studio and the AS Java provide tools for helping you debug your applications. This document provides the very basics on starting to debug applications, and provides a short, simple but clear example on how the debugging tools can be used. Author: Daniel Wroblewski Company: SAP AG Created on: 18 July 2007 Author Bio Daniel Wroblewski is an information developer for SAP, focusing on documentation for portal developers. He has been a developer ever since writing assembler code for the new Apple Macintosh in 1985 (that was cool), and was a developer for Deutsche Bank (Java, VB). He plays center for the SAP Labs Israel basketball team. 2007 SAP AG 1

Table of Contents Overview... 3 Collecting Required Information... 4 Message Server Port... 5 Debug Port... 6 Enabling Debugging... 9 Setting the AS Java... 10 Starting Debugging... 12 Debugging... 14 Set Breakpoints... 14 Inspect Variables... 15 Add Watches... 16 Example... 17 Open Portal Project... 18 Start Debugging... 19 Run the Application... 21 Related Content... 23 Copyright... 24 2007 SAP AG 2

Overview The debugging tools of the AS Java and NetWeaver Developer Studio can help a lot in locating problems with your applications. The following are basic instructions for debugging portal applications. Also provided is a small example of how a simple NullPointerException can be diagnosed using debugging. 2007 SAP AG 3

Collecting Required Information To use debugging, you will need to know the following information: Server Name: The host name for calling the portal in a browser Server Port: The port number for calling the portal in a browser Message Server Port: The port number for calling the AS Java engine, for example, from within the IDE Debug Port: The port number when starting debugging 2007 SAP AG 4

Message Server Port To find the message server port: 1. Launch the AS Java home page by entering in your browser the URL http://<server>:<port>/ (the same as the main portal URL without the irj). 2. Click System Information. Information about the AS Java, such as the server name, instances and ports numbers, is displayed. The message server port is displayed in the upper left. 2007 SAP AG 5

Debug Port 1. Launch the Config Tool by double-clicking configtool.bat (located in the C:\usr\sap\<system ID>\<instance ID>\j2ee\configtool directory). 2007 SAP AG 6

2. Click. The following is displayed: 2007 SAP AG 7

3. Navigate to cluster_data, and click Propertysheet. A table of properties is displayed. The debug port is listed under DebugPort. Note: You can also see the debug mode in the J2EE Engine view of the NetWeaver Developer Studio (below), as well as from the Servers Debug tab when clicking on the instance in the Config Tool. 2007 SAP AG 8

Enabling Debugging 1. Launch the Config Tool by double-clicking configtool.bat (located in the C:\usr\sap\<system ID>\<instance ID>\j2ee\configtool directory). 2. Click on the instance, and select the Servers Debug tab. 3. Make sure the debuggable and Enabled debug mode checkboxes are selected. 4. Save your changes, and restart the server. 2007 SAP AG 9

Setting the AS Java 1. In NetWeaver Developer Studio, select the menu item Window Preferences. 2. Click SAP J2EE Engine, and enter the portal server and message port. 3. Click OK. 4. Open up the J2EE Engine view by navigating to Windows Show View Other, and selecting J2EE J2EE Engine. 2007 SAP AG 10

5. Click to refresh the view. You should now see the server you specified in the Preferences window, with the colors of the nodes indicating the server s status. The current debug mode and port are shown at right. 2007 SAP AG 11

Starting Debugging Before starting to debug, make sure the current version of your project is deployed on the server. 1. Select debugging by either: Selecting Debug under the Debug icon. Selecting Run Debug in the menu. 2007 SAP AG 12

The Debug perspective is opened, and the configuration window is displayed. 2. Select Remote Java Application, click New, and set the following: Project: Select the project that you want to debug. Make sure its most recent version is deployed to the server on which you are debugging. Server: The server on which you are debugging. Debug Port: The debug port of the server. 3. Click Debug. You are now ready to debug. 2007 SAP AG 13

Debugging When debugging, you set breakpoints and watches in the portal component class files, and then run your portal component by navigating in the portal to an iview from your portal component. The portal component pauses when it hits a breakpoint, and the Debug view shows where you are in the component. You can step over or into your code, and inspect variables, functions and expressions. Set Breakpoints 1. Make sure the class file that you want to debug is open. You can open it from Enterprise Portal perspective before debugging. 2. Set a breakpoint by double-clicking at the start of the line. Below, a breakpoint is set on the first line of code in the docontent() method: 2007 SAP AG 14

Inspect Variables When the debugger has stopped at a breakpoint, you can inspect all the local variables, in the Variables window. The variables in the window are those defined in the docontent() method up to the breakpoint. 2007 SAP AG 15

Add Watches You specify variables, expressions and functions to a watch list to help you monitor them. The watch list is shown in the Expressions window. 2007 SAP AG 16

Example I have written a test portal component (HelloWorldProject.testLink) that takes a parameter with a navigation target and creates a link from it. The component tests to see if the parameter starts with the string pcd but, of course, if the parameter is null, the component will crash. The code is as follows: public void docontent(iportalcomponentrequest request, IPortalComponentResponse response) { String target = request.getparameter("mytarget"); if (target.startswith("pcd")) { response.write("starts With PCD<BR>"); } } // Rest of code And the iview displays the following when no parameter is sent. The exception is caught by the Portal Runtime. At first, I do not know why it crashes (and I did not provide any exception handling for the sake of this example). So I choose to debug. In this example, I assume that debug mode is turned on for the server. To turn on debug mode, see Enabling Debugging. 2007 SAP AG 17

Open Portal Project Open the portal project that you want to debug, and open the Java editor for the class file that contains the code to debug. The following shows the HelloWorldProject, with the testlink class that contains the code to debug. The J2EE Engine view is shown at the bottom right. 2007 SAP AG 18

Start Debugging 1. Click Run Debug. 2. Select Remote Java Application, and click New. 3. Enter HelloWorldProject for the project, and enter the server and port. 2007 SAP AG 19

4. Click Debug. The Debug perspective opens. A list of threads is displayed in upper left, and windows for displaying breakpoints and watches are displayed in the upper right. My code is also displayed in the middle. 5. Create a breakpoint for the first line in the docontent() method. 2007 SAP AG 20

Run the Application 1. Now I open the portal and run my iview. As soon as I click on the link to my iview (testlink), the debugger in the NetWeaver Developer Studio comes to life, the Debug perspective opens, and the execution stops at my breakpoint. The line is highlighted and an arrow is displayed next to the line. 2. I step through the first statement, by clicking Run Step Over or pressing F6. 2007 SAP AG 21

3. I check the variables, and notice that target is null. 4. I step through the next statement, and the component crashes. At the very least, I learn the statement that caused the crash. I can also check the log at this point and see that a NullPointerException caused the problem. #1.5#000BCDDCE9DE00700000000800000E2C00043584CF3F6D20#1184744435504#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#Administr ator#35#####thread[prt-async 3,5,PRT-Async]##0#0#Error#1#/System/Server#Java###Exception ID:07:40_18/07/07_0005_4070150 [EXCEPTION] {0}#1#com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Portal Component Component : pcd:portal_content/danielcontent/danrole/testlink Component class : testlink User : Administrator at com.sapportals.portal.prt.core.portalrequestmanager.handleportalcomponentexception(portalrequestmanager.java:969) at com.sapportals.portal.prt.core.portalrequestmanager.callportalcomponent(portalrequestmanager.java:343) at com.sapportals.portal.prt.core.portalrequestmanager.dispatchrequest(portalrequestmanager.java:136) at com.sapportals.portal.prt.core.portalrequestmanager.dispatchrequest(portalrequestmanager.java:189) at com.sapportals.portal.prt.core.async.asyncportalcomponentresponse.include(asyncportalcomponentresponse.java:355) at com.sapportals.portal.prt.core.async.asyncportalcomponentresponse.include(asyncportalcomponentresponse.java:310) at com.sapportals.portal.navigation.workareaiview.docontent(workareaiview.java:169) at com.sapportals.portal.prt.component.abstractportalcomponent.servicedeprecated(abstractportalcomponent.java:209) at com.sapportals.portal.prt.component.abstractportalcomponent.service(abstractportalcomponent.java:114) at com.sapportals.portal.prt.core.portalrequestmanager.callportalcomponent(portalrequestmanager.java:328) at com.sapportals.portal.prt.core.portalrequestmanager.dispatchrequest(portalrequestmanager.java:136) at com.sapportals.portal.prt.core.async.asyncincluderunnable$1$dodispatchrequest.run(asyncincluderunnable.java:377) at java.security.accesscontroller.doprivileged(native Method) at com.sapportals.portal.prt.core.async.asyncincluderunnable.run(asyncincluderunnable.java:390) at com.sapportals.portal.prt.core.async.threadcontextrunnable.run(threadcontextrunnable.java:164) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:729) at java.lang.thread.run(thread.java:534) Caused by: java.lang.nullpointerexception at testlink.docontent(testlink.java:16) at com.sapportals.portal.prt.component.abstractportalcomponent.servicedeprecated(abstractportalcomponent.java:209) at com.sapportals.portal.prt.component.abstractportalcomponent.service(abstractportalcomponent.java:114) at com.sapportals.portal.prt.core.portalrequestmanager.callportalcomponent(portalrequestmanager.java:328)... 15 more 2007 SAP AG 22

Related Content Debugging J2EE Applications Debugging Tools: Log Watch, Navigation Reporter and Navigation Debugger (SAP NetWeaver 7.0 only) 2007 SAP AG 23

Copyright Copyright 2007 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iseries, pseries, xseries, zseries, z/os, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/os, POWER, POWER5, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mysap, mysap.com, xapps, xapp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. Any software coding and/or code lines/strings ( Code ) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent. 2007 SAP AG 24