jpda를 이용하여 리모트 디버깅이 가능하다. jpda라는 것을 이용하면 된다. 설명은 아래~
써머으니 좋더라~~
http://www.eaves.org/blog-archive/000246.html
Debugging with Tomcat and Eclipse using jpda
I've not had much need for debugging my servlets, but while I'm currently working on a legacy codebase, it's a great means of stepping through what is really happening.
I'm not a fan of the "run Tomcat in Eclipse", well, just because it feels ooky, and I'd rather run the two VM's separately so I can bounce them independently, and because I write such crap code, I'd rather not crash both of them at the same time.
The information on how to make Tomcat and Eclipse play nicely together is a bit sparse, so I've provided a nice little summary here. This is working with Tomcat 5.0.X, Eclipse 3.2, JDK 1.4.2_*
Step 1. Configure Tomcat
(This is for the Win32 build with the spiffy UI for starting/stopping)
a) Open up the configuration GUI ("Configure Tomcat")
b) Select the Java tab
c) Into the Java Options include (substituting the correct locations)
-Xdebug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
-Dcatalina.home=c:\tomcat
-Djava.endorsed.dirs=c:\tomcat\common\endorsed
-Djava.io.tmpdir=c:\tomcat
NB: These are all on separate lines, with a <CR> at each EOL
d) Select the Startup tab
e) Into the Arguments section include:
jpda
start
NB: These are all on separate lines, with a <CR> at each EOL
f) Start and Stop Tomcat completely
2. Configure Eclipse (well, not much really to configure)
a) While in the Java perspective select Run/Debug...
b) Choose "Remote Java Application" from the tree (right click/New)
c) The defaults are all that is required.
d) Click "Debug" in the bottom corner to start it now, or Close for later
3. Debugging the Application
a) Select the servlet/code that requires examination
b) Create a breakpoint in the code
c) Click on the "Debug" (if not already debugging) (*)
d) Click on the Debug Perspective (optional)
-- this should show the Eclipse connected to Tomcat, and there should be a huge list Threads and the title of the Debug should be something like:
NameOfApplication [Remote Java Application]
Java HotSpot(TM) Server VM[localhost:8000]
e) Now just run the application as normal (via a browser or whatever)
f) Watch in amazement as Eclipse debugs the application at the breakpoint.
(*) If you get an error such as "Failed to connect to remote VM. Connection Refused". This normally means that Tomcat isn't started, _or_ there is already a debugging session started via jpda. Check Tomcat is running, and check the Debug perspective to make sure that it isn't running.
Posted by jon at May 10, 2006 10:16 AM'java core' 카테고리의 다른 글
아파치 세션이 계속 있다?? (0) | 2009.02.20 |
---|---|
jstack (0) | 2009.02.20 |
multipool / 웹 미들웨어 조사 (0) | 2009.02.06 |
JVM Tiered Compiler (또는 compilations) (0) | 2009.02.04 |
<img src="http://blogimgs.naver.com/nblog/ico_scrap02.gif" class="i_scrap" width="50" height="15" alt="링크스크랩" /> [ Enterprise Java는 거대한 동기화 머신이다 - GC ] E.. (0) | 2009.01.24 |