- 浏览: 3502094 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
wanglf1207:
EJB的确是个不错的产品,只是因为用起来有点门槛,招来太多人吐 ...
weblogic-ejb-jar.xml的元素解析 -
qwfys200:
总结的不错。
Spring Web Flow 2.0 入门 -
u011577913:
u011577913 写道也能给我发一份翻译文档? 邮件437 ...
Hazelcast 参考文档-4 -
u011577913:
也能给我发一份翻译文档?
Hazelcast 参考文档-4 -
songzj001:
DbUnit入门实战
The Java Debugger
The Java Debugger (jdb) is a dynamic, controlled, assignment-based debugging tool. It helps find and fix bugs in the Java language programs both locally and on the server. To use jdb in a J2EE application server you must first launch it with debugging enabled and attach to the server from the debugger through a JPDA port (Default port is 1044).
The default JPDA options for J2EE servers are as follows:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
The jdb parameters specify the way debugger will operate. For instance transport=dt_socket instructs the JVM that the debugger connections will be made through a socket while the address=1044 parameter informs it that the port number will be 1044. Similarly, if you substitute suspend=y , the JVM starts in suspended mode and stays suspended until a debugger is attached to it. This may be helpful if you want to start debugging as soon as the JVM starts.
Debugging WebLogic
Debugging WebLogic is no different than debugging any other Java remote application. You need to make sure to launch it with the required debugging arguments and attach a debugger. In the case of WebLogic 8.1, you need to add these arguments to the startup script. WebLogic comes with several launch scripts (*.sh and *.cmd) under BEA_HOME/weblogic81/server/bin.
- Locate startWSL.cmd and add the following variable DEBUG_OPTS:
set DEBUG_OPTS = -Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n
- Next, insert the new variable to the WebLogic startup command, after "%JAVA_HOME%\bin\java" and preferably before the other options.
- Your startup script should look like:
"%JAVA_HOME%\bin\java" %DEBUG_OPTS% %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS%-Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username= %WLS_USER%-Dweblogic.management.password= %WLS_PW% -Dweblogic.management.server= %ADMIN_URL%-Dweblogic.ProductionModeEnabled= %PRODUCTION_MODE%-Djava.security.policy= "%WL_HOME%\server\lib\weblogic.policy" weblogic.Server
Debugging JBoss
Same as WebLogic, except that you need to change run.bat/run.sh located under JBOSS_HOME/bin.
Linux users should see something similar to this:
$ cd /var/jboss4/bin $ sh ./run.sh ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /var/jboss4 JAVA: /usr/java/j2sdk1.4.2_06/bin/java JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh DEBUG_OPTS = -Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n CLASSPATH: /var/jboss4/bin/run.jar:/usr/java/j2sdk1.4.2_06/lib/tools.jar =========================================================================
Debugging Tomcat
Again, very much similar to WebLogic and JBoss, except that you need to change catalina.bat/catalina.sh located under TOMCAT_HOME/bin.
Debugger Verification
Now you can launch your application in debug mode. Just to make sure that the server is
listening to port 1044 you can run netstat /a. You should see port 1044 in the list of open ports
(See Figure 1: List of open ports: netstat -a).
Figure 1 List of open ports: netstat -a
The Eclipse Connection
After making sure WebLogic is listening for incoming connections on port 1044, what is left is to tell Eclipse to connect to this port and you are ready to debug.
- In Eclipse, navigate to Run | Debug (See Figure 2: Create new Remote Java Application configuration in Eclipse ).
- Select Remote Java Application , on the left column. Click New , on the bottom of the same column.
- In the Create configuration screen you'll be prompted to enter some values. Start with a meaningful name. In my case that's WebLogic Instance . For Project, select the Java project that contains the source code you want to debug. Leave Connection Type in default, i.e. Standard (Socket Attach) . For Host , enter localhost. If you want to debug a remote server, enter its hostname or IP address. For port, enter 1044 or the port you defined in your WebLogic startup script.
- Click Apply
- Make sure WebLogic instance is running in debug mode. In the same screen click Debug . Eclipse should automatically take you to the Debug perspective and you should see a stack trace in the Debug view.
- If you are not automatically taken to the Debug perspective, select Window | Open Perspective | Other and then click Debug.
Figure 2 Create new Remote Java Application configuration in Eclipse
Figure 3 Breakpoint hit in Eclipse debugger
<span http://Eclipse Debug window should automatically pop-up with the stack pointer on your first breakpoint (See Figure 3: Breakpoint hit in Eclipse's debugger ). After that, you can use all the various functions that the debugger has to offer, namely variable assignments, step-into, drop to frame, etc.
References
- Debugging J2EE Applications
- Connecting to a Remote VM with the Java Remote Application Launcher
- Debugging with the Eclipse Platform
System Information
- Windows 2000
- JDK 1.4.2_03
- Eclipse 3.0
- BEA WebLogic 8.1
- JBoss 4.0.2
- Tomcat 5.0.26
发表评论
-
字符串分割--java中String.split()用法
2013-03-06 14:25 74149在java.lang包中有String.sp ... -
用 HttpServletResponseWrapper 实现 Etag 过滤器
2012-07-09 16:58 3757原文出处:http://blog.chenlb.com/200 ... -
Fitnesse使用
2012-05-05 13:27 23492Fitnesse 的使用 一,介绍 Fitnesse是一种 ... -
Customizing the new FitNesse parser
2012-05-05 13:13 2133FitNesse began its life using ... -
java application中内嵌ActiveX控件
2011-11-14 15:57 5522我这里用的是SWT/JFace开发application,SW ... -
Google Java Developer Tools Downloads
2011-08-09 00:04 2346WindowBuilder Pro原来叫WindowB ... -
Jalita
2011-08-06 00:49 1565Jalita (Java light terminal ada ... -
【转】用Java写字符终端界面
2011-07-29 13:13 2120终端界面GUI开源项目charva。 这个框架让你可以用开发 ... -
[转]mybatis下的分页,支持所有的数据库
2011-07-21 13:21 14838大 家都知道,mybatis的自带分页方法只是逻 ... -
Java framework for text- & console-based forms?
2011-07-21 01:06 1709charva jcurses JNA , ... -
JNA(Java Native Access)学习入门
2011-07-21 01:04 22619Java Native Access 项目 在 ... -
JAVA上加密算法的实现用例
2011-06-25 12:38 4883来源:www.ibm.com ... -
如何将GlassFish作为Windows服务运行
2011-05-18 23:21 2372本文档来自GlassFish官方网站,详细介绍了将 G ... -
JAVA UDP打洞必备知识点---NAT
2011-05-05 12:56 8692一、引言 RFCl631 ... -
Keystore概念,Keytool工具使用
2011-04-28 16:20 2905近来由于项目需要做Single Sign On, 研究了一 ... -
利用Eclipse Profile Plugin监控分析Tomcat性能
2011-04-18 16:14 3701目前新版本的Eclipse在启动应用服务器的时候有一个新的选 ... -
m2eclipse: Eclipse is running in a JRE, but a JDK is required
2011-02-04 23:43 2540Eclipse 安装了Maven插件,启动Eclipse ... -
利用JNative实现Java调用动态库
2010-10-18 00:43 2099由于项目要求,需要用J ... -
RHEL5支持大内存
2010-10-08 16:19 3004安装 RHEL 5 ,硬件为 4G 内存,安装完成 ... -
Windows Server 2003 和 Windows 2000 提供大内存支持
2010-10-08 16:19 1854本文介绍物理地址扩展 ...
相关推荐
This is the Tenth Edition, of Debugging with GDB: the GNU Source-Level Debugger for GDB (GDB) Version 8.1.90.20180814-git. Copyright © 1988-2018 Free Software Foundation, Inc. Permission is granted...
Debugging With GDB 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
《Debugging with gdb中文带书签特别版》是一本关于GNU源代码级调试器GDB的中文教程书籍,适配gdb版本6.8.50.***。书中详细介绍了GDB的各种功能、命令以及如何使用该工具进行有效的程序调试。 首先,书中提供了一个...
根据提供的信息,我们可以总结并详细解释与“debugging_with_gdb(中文版pdf)”相关的知识点。这份文档似乎是一份关于使用 GDB(GNU Debugger)进行调试的手册或指南的中文版 PDF 文件。GDB 是一个非常强大的开源调试...
Visual Studio 2005 Remote Debugging.mht
Debugging with Fiddler,介绍Fiddler的书籍
GDB还支持远程调试,通过`target remote`命令连接到远程服务器进行调试,这对于分布式系统或嵌入式设备的调试非常有用。 十、调试动态库与多线程 GDB能处理动态链接的库,并允许在多线程环境中调试。使用`shared...
《使用gdb进行调试 第十版》是介绍GNU源码级调试器gdb的官方文档。本书由Richard Stallman、Roland Pesch、Stan Shebs等多位作者撰写,旨在为用户提供一个全面的gdb使用指南,涵盖gdb版本7.5至1.0.53。...
gdb调试工具官方介绍文档 Debugging with gdb The gnu Source-Level Debugger Tenth Edition, for gdb version 10.0.50.20200111-git (GDB) Richard Stallman, Roland Pesch, Stan Shebs, et al.
### 使用Eclipse构建与调试Pentaho 2.0 #### 概述 本文档将详细介绍如何在Eclipse集成开发环境中设置开发环境,包括如何连接到Pentaho Subversion仓库、检出Pentaho项目、构建这些项目以及使用独立的Java应用...
Debugging.with.Fiddler 带书签
Debugging with Fiddler 2012 (英文版 Eric Lawrence 亚马逊5星 热评 畅销书) 网络编程 Web服务开发调试利器 亚马逊11个客户全部评5星,热评畅销书。 Web Services 开发必备。
### 使用GDB进行调试 #### 概述 GDB(GNU调试器)是GNU项目下的一款强大而灵活的源码级调试工具,广泛应用于Linux环境下C/C++等语言编写的程序调试。它允许用户对程序执行过程进行控制,观察变量状态,分析程序...
### 《调试的艺术:使用GDB、DDD及Eclipse》 #### 书籍概述 《调试的艺术:使用GDB、DDD及Eclipse》是一本由Norman Matloff与Peter Jay Salzman合著的专业书籍,旨在帮助程序员掌握高效调试技巧。本书不仅深入介绍...