`

remote debugging

 
阅读更多
http://www.eclipsezone.com/eclipse/forums/t53459.html

Remote Debugging with Eclipse

At 8:22 PM on Nov 1, 2005, Levent Gurses Javalobby Newcomers wrote:

<!-- Synopsis -->

How many times trying to fix a server-side Java problem appeared trivial, but getting to the source of the problem took all the time? A remote debugger attached to a Java application can shorten the defect-discovery times significantly and make the process more enjoyable.

<!-- What is it -->

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.

  1. Locate startWSL.cmd and add the following variable DEBUG_OPTS:
    set DEBUG_OPTS = -Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n
        
  2. Next, insert the new variable to the WebLogic startup command, after "%JAVA_HOME%\bin\java" and preferably before the other options.
  3. 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.

  1. In Eclipse, navigate to Run | Debug (See Figure 2: Create new Remote Java Application configuration in Eclipse ).
  2. Select Remote Java Application , on the left column. Click New , on the bottom of the same column.
  3. 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.
  4. Click Apply
  5. 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.
  6. 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


System Information

  • Windows 2000
  • JDK 1.4.2_03
  • Eclipse 3.0
  • BEA WebLogic 8.1
  • JBoss 4.0.2
  • Tomcat 5.0.26

About the Author

Levent Gurses is a Washington, DC-based technology consultant. He is also one of the co-founders of Jacoozi , an integrated solutions provider based in Alexandria, VA. In his professional life Levent helps clients overcome their J2EE challenges and develop leaner and meaner software development practices. Most of his free time goes in reading and motorcycle racing.

  Click to reply to this thread Reply
1. At 4:57 PM on Nov 3, 2005, the Q Master Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

The major problem to me is not how to set the remote debugger in eclipse but rather to transform the development + debugging a easy proccess.

I managed to debug and edit my J2EE project in the same time with tomcat using Eclipse and I'm looking to find a similar way with Weblogic.

I don't like the fact that I loose time to deploy every single time before debugging and I aim to have the Weblogic looking in my eclipse project (that is structured as a exploded war).

One tomcat advantange - it has an option to load the changes on the fly and that shortens the development and debugging process.
Affordable Stock Photography http://www.goodstockimages.com
  Click to reply to this thread Reply
2. At 5:09 PM on Nov 3, 2005, Levent Gurses Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

Hot code replace (hot deploys) is a time-saving feature, I agree and Tomcat is by far the easiest to set for hot code replace. JBoss can also be tuned to support it, though not for all class changes. Interestingly, I had hard time achieving the same with WebLogic. Maybe BEA gurus can help us here?

PS: You may want to have a look at this discussion (http://jroller.com/page/gursesl/cleanfulltext/remote_application_debugging_with_weblogic)
Levent Gurses
Jacoozi - New Generation E-Solutions for >> Thinking Companies
www.jacoozi.com
  Click to reply to this thread Reply
3. At 7:36 AM on Nov 4, 2005, Michele Campeotto Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

For Tomcat (5.5 here, don't know about other versions) you don't need to edit catalina.sh, just start it with:

$ ./bin/catalina.sh jpda start

and it will use dt_socket on port 8000.

(I had to do this yesterday :) )
  Click to reply to this thread Reply
4. At 3:29 PM on Nov 11, 2005, Sunil Kamath Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

Here's another good article on ths subject:
http://www-128.ibm.com/developerworks/library/os-ecdiag/?ca=dnt-427
  Click to reply to this thread Reply
5. At 3:39 PM on Nov 11, 2005, Levent Gurses Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

I like the fact that you can debug an Eclipse workbench remotely:

> Listing 1. Launching a remotely debuggable workbench

>eclipse.exe -vmargs -Xdebug -Xnoagent \
>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n


Levent Gurses
Jacoozi - New Generation E-Solutions for >> Thinking Companies
www.jacoozi.com
  Click to reply to this thread Reply
6. At 9:12 AM on Dec 19, 2005, Michael Murphy Javalobby Newcomers wrote:

WebSphere - Enabling debugging

From the WebSphere 5.X/6.X console, go to

Servers > Application Servers > [SERVERNAME] > Process Definition > Java Virtual Machine

Check off Debug Mode
Arguments can be edited in the field called "Debug arguments".
  Click to reply to this thread Reply
7. At 12:19 PM on Jan 6, 2006, David Peng Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

Do you have experience for remote debugging Tomcat 5.5 on windows platform, there is no such batch file, like tomcat.bat, startup.bat, shutdown.bat.
Thanks.
  Click to reply to this thread Reply
8. At 9:03 AM on Jun 9, 2006, Sunil Kamath Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

More on this at: http://www-128.ibm.com/developerworks/library/os-ecdiag/?ca=dnt-427
  Click to reply to this thread Reply
9. At 10:04 AM on Sep 25, 2006, Levent Gurses Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

Here is an updated version of the write-up covering several more app servers:


Remote Debugging with Eclipse (Jacoozi Article)
Levent Gurses
Jacoozi - New Generation E-Solutions for >> Thinking Companies
www.jacoozi.com
  Click to reply to this thread Reply
10. At 10:18 AM on Apr 24, 2007, sumedh Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

I tried this with Weblogic but its not working. It straight away starts as usual in running mode on 7001 port.

Attached the screenshot.

Marked in red are the debug options added to java start command.
  Click to reply to this thread Reply
11. At 11:10 AM on Jun 12, 2007, dushyant Javalobby Newcomers wrote:

Re: Remote Debugging with Eclipse

Hi,

I am remote debugging Weblogic 8.1 but everytime I make even a smallest of code change the hot code replace always fails. The weblogic is using the JRE jrockit81sp5_142_08 so I have configured eclipse also to use the same JRE but code swap always fails. Please help.
  Click to reply to this thread Reply
13. At 5:36 PM on Jul 18, 2007, Alex Blewitt DeveloperZone Top 100 wrote:

Re: Remote Debugging with Eclipse

Not all JREs support hot-swap bytecode; JRockit is one of them. In short; you can't do it if you're using JRockit. (In Eclipse 3.3, if you right-click on a remote application, then you can see what services the remote VM provides.)

Alex.
分享到:
评论

相关推荐

    Visual Studio 2005 Remote Debugging.mht

    Visual Studio 2005 Remote Debugging.mht

    MyEclipse_Remote_Debugging_Quickstart

    MyEclipse_Remote_Debugging_Quickstart.pdf Outline 1. Preface 2. Introduction 3. Configuring the Server for Remote Debugging 1. WebLogic 8.1 Server 2. Tomcat 5.x Server 3. Sun Java System ...

    Debugging ASP.NET

    Remote Debugging Summary 8. Leveraging the Windows 2000 Event Log The Windows 2000 Event Log Defined Web Applications Can Use the Event Log The System.Diagnostics Event Log Interface ...

    Remote Debugging Information Server-开源

    调试服务器允许远程调试日志记录并通过基于Web的界面访问信息。

    Debugging with GDB --2002年5.11

    r Remote debugging s The GDB remote serial protocol s What the stub can do for you s What you must do for the stub s Putting it all together s Communication protocol s Using the gdbserver program s ...

    PHP调试,使用Komodo和Xdebug进行PHP程序的调试(2)

    PHP调试,使用Komodo和Xdebug进行PHP程序的调试(2) PHP调试,使用Komodo和Xdebug进行PHP程序的调试(2) PHP调试,使用Komodo和Xdebug进行PHP程序的调试(2) PHP调试,使用Komodo和Xdebug进行PHP程序的调试(2)

    ASP.NET MVC with Entity Framework and CSS

    • Azure deployment using Code First Migrations, remote debugging and viewing/editing your remote data • CSS Styling including animation and media queries What You Will Learn: • Get up and running ...

    ug1169-xilinx-qemu.pdf

    • GDB for remote debugging QEMU • Generation of guest software application using Xilinx® PetaLinux and SDK tools • Device trees This document provides the basic information to familiarize, use,...

    ASP.NET MVC with Entity Framework and CSS [2016]

    • Azure deployment using Code First Migrations, remote debugging and viewing/editing your remote data • CSS Styling including animation and media queries What You Will Learn: • Get up and running...

    Debugging with GDB --2003年6.0

    Debugging programs with multiple processes . . . . . . . . . . . . 23 24 25 25 26 26 27 28 28 30 Stopping and Continuing . . . . . . . . . . . . . . . . . . 33 5.1 Breakpoints, watchpoints, and ...

    chrome-edge-launcher:从节点轻松启动Microsoft Edge

    ,自动化方案增加噪音在可用端口上打开浏览器的remote-debugging-port端口自动找到要启动的Edge二进制文件每次启动使用新的Edge配置文件,并使用kill()清理自身绑定Ctrl-C (默认情况下)以终止Edge进程公开了一小...

    Debugging with GDB --2001年5.3

    Debugging programs with multiple processes . . . . . . . . . . . . 23 24 25 25 26 26 27 28 28 30 Stopping and Continuing . . . . . . . . . . . . . . . . . . 33 5.1 Breakpoints, watchpoints, and ...

    Addison Wesley - Embedded Linux - Hardware,Software,and Interfacing.chm

    It includes a comprehensive discussion of platform selection, crosscompilation, kernel compilation, root filesystem creation, booting, remote debugging, real-world interfacing, application control, ...

    pentaho-kettle-master.zip

    To run a single integration test in debug mode (for remote debugging in an IDE) on the default port of 5005: $ mvn verify -DrunITs -Dit.test=&lt;&lt;YourIT&gt;&gt; -Dmaven.failsafe.debug To skip test $ ...

    计算机文献翻译集成用于论文后期制作

    Learn how to spread around your debugging using different connection types that make up remote debugging. This article explains the features and examples that show how to set up remote application ...

    ActiveState Komodo IDE 10.2.1.89853 Setup + Keygen

    - Chrome Remote Debugging: Debug your code in Chrome, from Komodo! No more context switching or locating the same code you've been working on again in the Chrome dev tools. You can write code, place...

    hadoop 权威指南(第三版)英文版

    Remote Debugging Tuning a Job Profiling Tasks MapReduce Workflows Decomposing a Problem into MapReduce Jobs JobControl Apache Oozie 6. How MapReduce Works . . . . . . . . . . . . . . . . . . . . . . ...

Global site tag (gtag.js) - Google Analytics