Remote debug with Tomcat 5.0

Hello!

Have anyone successful IDEA remote debugging of servlet on Tomcat 5.0?

--
Stanislav Davydov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0
17 comments

Yes

"Stanislav Davydov (JetBrains)" <stathik@intellij.com> wrote in message
news:bv65ba$qv2$1@is.intellij.net...

Hello!

>

Have anyone successful IDEA remote debugging of servlet on Tomcat 5.0?

>

--
Stanislav Davydov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>


0

I have tried but I can't figure out how.
Is there a guide to remote debugging with tomcat 5.0?

0

You have to set a registry key (for Window anyway).

"Yogurt Earl" <no_mail@jetbrains.com> wrote in message
news:11616958.1075231822176.JavaMail.itn@is.intellij.net...

I have tried but I can't figure out how.
Is there a guide to remote debugging with tomcat 5.0?

>
>


0

If I remember correctly here it is:

set JDPA_TRANSPORT=dt_socket
set JDPA_ADDRESS=5005
%CATALINA_HOME%\bin\catalina.bat jpda start

This must be the same as in IDEA Run/Debug Configurations => Remote

Hope this helps.

/Slawek

0

Stanislav Davydov (JetBrains) wrote:

Hello!

Have anyone successful IDEA remote debugging of servlet on Tomcat 5.0?


yep, I start tomcat with:

tomcat_home\bin\java -Xdebug -Xint -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
-Djava.endorsed.dirs="" -classpath ";..\bin\bootstrap.jar"
-Dcatalina.base=".." -Dcatalina.home=".." -Djava.io.tmpir="..\temp"
org.apache.catalina.startup.Bootstrap start

and just attach IDEA via remote debug tag on port 9999.

Works good, unfortunatly doesn't work for jsp2 but I can live with that.
And hotswap/reloading doesn't work properly .. tomcat sometimes starts
reloading the context (reloadable=true) while IDEA is still compiling
and tomcat complains about missing files.

EAP 1122, btw.

/thomas

0


"Thomas Heller" <eap@mx4k.com> wrote in message
news:bv6n6v$tip$1@is.intellij.net...

Stanislav Davydov (JetBrains) wrote:

Hello!

>

Have anyone successful IDEA remote debugging of servlet on Tomcat 5.0?

>

>

yep, I start tomcat with:

>

tomcat_home\bin\java -Xdebug -Xint -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
-Djava.endorsed.dirs="" -classpath ";..\bin\bootstrap.jar"
-Dcatalina.base=".." -Dcatalina.home=".." -Djava.io.tmpir="..\temp"
org.apache.catalina.startup.Bootstrap start

>

and just attach IDEA via remote debug tag on port 9999.

>

Works good, unfortunatly doesn't work for jsp2 but I can live with that.
And hotswap/reloading doesn't work properly .. tomcat sometimes starts
reloading the context (reloadable=true) while IDEA is still compiling
and tomcat complains about missing files.

>

EAP 1122, btw.

>

/thomas


What if you turn off reloading? Does it work then? Presumably reloading
isn't necessary if you've got hotswap.

Regards,

Glen


0

Glen Stampoultzis wrote:

"Thomas Heller" <eap@mx4k.com> wrote in message
news:bv6n6v$tip$1@is.intellij.net...

>>Stanislav Davydov (JetBrains) wrote:
>>
>>>Hello!
>>>
>>>Have anyone successful IDEA remote debugging of servlet on Tomcat 5.0?
>>>
>>
>>yep, I start tomcat with:
>>
>>tomcat_home\bin\java -Xdebug -Xint -Xnoagent -Djava.compiler=NONE
>>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
>>-Djava.endorsed.dirs="" -classpath ";..\bin\bootstrap.jar"
>>-Dcatalina.base=".." -Dcatalina.home=".." -Djava.io.tmpir="..\temp"
>>org.apache.catalina.startup.Bootstrap start
>>
>>and just attach IDEA via remote debug tag on port 9999.
>>
>>Works good, unfortunatly doesn't work for jsp2 but I can live with that.
>>And hotswap/reloading doesn't work properly .. tomcat sometimes starts
>>reloading the context (reloadable=true) while IDEA is still compiling
>>and tomcat complains about missing files.
>>
>>EAP 1122, btw.
>>
>>/thomas


What if you turn off reloading? Does it work then? Presumably reloading
isn't necessary if you've got hotswap.

Regards,

Glen


I'm using this setup since idea3.0.1 or something so I never really got
into hotswapping. To be honest I don't like hotswapping. But I tried it
yesterday and my guess is since idea is in a different vm than tomcat it
won't work. At least I get some "scheme not supported" error when trying
to hotswap.

0

tomcat_home\bin\java -Xdebug -Xint -Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,addre
s=9999
-Djava.endorsed.dirs="" -classpath
";..\bin\bootstrap.jar"
-Dcatalina.base=".." -Dcatalina.home=".."
-Djava.io.tmpir="..\temp"
org.apache.catalina.startup.Bootstrap start

and just attach IDEA via remote debug tag on port
9999.


I'm using the same debug settings with no luck. Intellij gets stuck at "Connecting..." when I try to debug. I've tried a few different ports incase there were conflicts. This is using tomcat 5.0 and java 1.4.2.

Jon

0

Ok, I restarted IDEA and it worked. I remember a bug where if the debugger failed to connect the first time you try it it will fail until a restart. I'm pretty sure a bug was submitted.

0

I have it working with .java. Why doesn't it work with .jsp?

--
Norris Shelton
Web Developer
Sun Certified Java Programmer


"Thomas Heller" <eap@mx4k.com> wrote in message
news:bv6n6v$tip$1@is.intellij.net...

Stanislav Davydov (JetBrains) wrote:

Hello!

>

Have anyone successful IDEA remote debugging of servlet on Tomcat 5.0?

>

>

yep, I start tomcat with:

>

tomcat_home\bin\java -Xdebug -Xint -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
-Djava.endorsed.dirs="" -classpath ";..\bin\bootstrap.jar"
-Dcatalina.base=".." -Dcatalina.home=".." -Djava.io.tmpir="..\temp"
org.apache.catalina.startup.Bootstrap start

>

and just attach IDEA via remote debug tag on port 9999.

>

Works good, unfortunatly doesn't work for jsp2 but I can live with that.
And hotswap/reloading doesn't work properly .. tomcat sometimes starts
reloading the context (reloadable=true) while IDEA is still compiling
and tomcat complains about missing files.

>

EAP 1122, btw.

>

/thomas



0

Yes works fine for servlets, just start tomcat with catalina.sh jpda run (or start) and then attach to the port. Hotswap works fine.

Haven't been able to get Remote to work nicely with JSPs though.

My setup is tomcat on a solaris box, idea on my xp machine.

0
Avatar
Stig Kleppe-Jorgensen

I haven't really tried reloading in Tomcat yet as I've mainly been working with
Weblogic. As we have a quite large application the reload will take quite a long
time. So when just one class is changed I like hotswap a lot better :)

The problem you experienced has nothing to do with IDEA being in a different VM.
It just means that the changes you did to your class is not supported by Hotswap
on the VM Tomcat runs under. That is, changes to a class' schema is not supported.
I think deleting methods is among the changes that would classify as changing a
class' schema.

I've done quite a lot of reloading classes and it works amazingly good even for
a web application with session objects, etc. As the project I'm on has Eclipse
as the default IDE I tried it there too, but then I got some error when trying
a reload. If I just had discovered that earlier...this would have made it easy
to convince the manager to by IDEA :)

Regards,
Stig

0

&gt; I have it working with .java. Why doesn't it work
&gt; with .jsp?

To debug jsps you need to actually have your webapp running through Intellij, not just attached by a remote debugger. I don't know the details all that well, but from what I gather Intellij specifies it's own directory for the compiled jsps that it can then reference back to any breakpoints you add.

Webapp runner/debuggers can be set up under the "WebApp" tab in the "Run/Debug Configurations" screen.

0

It works partially for me. Remote classes (ie, not JSP) are fine, including servlets. I can set a breakpoint at a JSP and IDEA will stop at that, but then stepping doesn't works -- but resuming and expression evaluation still does, at least.

0

Ah, there's a little trick: I added the directory where tomcat (in fact, JBoss 3.2.3 + Tomcat 5.0.16) generates java source code as a source folder for my web module.

0

ditto. Running through IntelliJ allows limited debugging of JSPs. I was
kind of disappointed. No stepping and it is a pain in the arse to find your
data values. The data values may have more to do with jasper2, then
IntelliJ.

--
Norris Shelton
Web Developer
Sun Certified Java Programmer


"Marcus Brito" <pazu@animegaiden.com.br> wrote in message
news:28497947.1075391825378.JavaMail.itn@is.intellij.net...

It works partially for me. Remote classes (ie, not JSP) are fine,

including servlets. I can set a breakpoint at a JSP and IDEA will stop at
that, but then stepping doesn't works -- but resuming and expression
evaluation still does, at least.


0

Hi, I think I know the issue here.

Add

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

to the Configure Tomcat java params.

do not put -Xnoagent this is the real culprit here
if you include -Xnoagent will recive error connection refused for ever .

Enjoy Happy development :)

0

Please sign in to leave a comment.