Document Information

Preface

Part I Introduction

1.  Overview

2.  Using the Tutorial Examples

Required Software

Tutorial Bundle

To Obtain the Tutorial Bundle

Java Platform, Standard Edition

Sun Java System Application Server 9.1

Application Server Installation Tips

NetBeans IDE

Apache Ant

Starting and Stopping the Application Server

Starting the Admin Console

Starting and Stopping the Java DB Database Server

Building the Examples

Building the Examples Using NetBeans IDE

Building the Examples on the Command-Line Using Ant

Tutorial Example Directory Structure

Part II The Web Tier

3.  Getting Started with Web Applications

4.  Java Servlet Technology

5.  JavaServer Pages Technology

6.  JavaServer Pages Documents

7.  JavaServer Pages Standard Tag Library

8.  Custom Tags in JSP Pages

9.  Scripting in JSP Pages

10.  JavaServer Faces Technology

11.  Using JavaServer Faces Technology in JSP Pages

12.  Developing with JavaServer Faces Technology

13.  Creating Custom UI Components

14.  Configuring JavaServer Faces Applications

15.  Internationalizing and Localizing Web Applications

Part III Web Services

16.  Building Web Services with JAX-WS

17.  Binding between XML Schema and Java Classes

18.  Streaming API for XML

19.  SOAP with Attachments API for Java

Part IV Enterprise Beans

20.  Enterprise Beans

21.  Getting Started with Enterprise Beans

22.  Session Bean Examples

23.  A Message-Driven Bean Example

Part V Persistence

24.  Introduction to the Java Persistence API

25.  Persistence in the Web Tier

26.  Persistence in the EJB Tier

27.  The Java Persistence Query Language

Part VI Services

28.  Introduction to Security in the Java EE Platform

29.  Securing Java EE Applications

30.  Securing Web Applications

31.  The Java Message Service API

32.  Java EE Examples Using the JMS API

33.  Transactions

34.  Resource Connections

35.  Connector Architecture

Part VII Case Studies

36.  The Coffee Break Application

37.  The Duke's Bank Application

Part VIII Appendixes

A.  Java Encoding Schemes

B.  About the Authors

Index

 

Debugging Java EE Applications

This section describes how to determine what is causing an error in your application deployment or execution.

Using the Server Log

One way to debug applications is to look at the server log in domain-dir/logs/server.log. The log contains output from the Application Server and your applications. You can log messages from any Java class in your application with System.out.println and the Java Logging APIs (documented at http://download.oracle.com/javase/6/docs/technotes/guides/logging/index.html) and from web components with the ServletContext.log method.

If you start the Application Server with the --verbose flag, all logging and debugging output will appear on the terminal window or command prompt and the server log. If you start the Application Server in the background, debugging information is only available in the log. You can view the server log with a text editor or with the Admin Console log viewer.

To use the log viewer:

  1. Select the Application Server node.

  2. Select the Logging tab.

  3. Click the Open Log Viewer button. The log viewer will open and display the last 40 entries.

If you wish to display other entries:

  1. Click the Modify Search button.

  2. Specify any constraints on the entries you want to see.

  3. Click the Search button at the bottom of the log viewer.

Using a Debugger

The Application Server supports the Java Platform Debugger Architecture (JPDA). With JPDA, you can configure the Application Server to communicate debugging information using a socket.

To debug an application using a debugger:

  1. Enable debugging in the Application Server using the Admin Console:

    1. Select the Application Server node.

    2. Select the JVM Settings tab. The default debug options are set to:

      -Xdebug -Xrunjdwp:transport=dt_socket,server=y, suspend=n,address=9009

      As you can see, the default debugger socket port is 9009. You can change it to a port not in use by the Application Server or another service.

    3. Check the Enabled box of the Debug field.

    4. Click the Save button.

  2. Stop the Application Server and then restart it.