See Chapter 3, Debugging Applications, in Sun GlassFish Enterprise Server v3 Prelude Developer’s Guide.