Debugging with Tomcat5.0

Hi.
I'm developing a web application using Hibernate, Spring and WebWork.
My tools are IntelliJ6 and Tomcat5.0.28
I want to set some break points in my actions and DAOs.
How to use the debugger while the application is running under Tomcat ?
What is Tomcat local and Tomcat remote in Debug tab ?
I did the following :
- Creating Tomcat remote configuration
- I double clicked at Tomcat monitor, Java tab, adding the following line to
Java Options panel.
(I copied this line from what IntelliJ gave me)

- I pressed "Debug" button but I got a connection exception.
So, would you mind telling me to use IntelliJ and Tomcat to debug (an order list of required steps) ?
Thanks.

15 comments
Avatar
Nikolay Chashnikov
Comment actions Permalink

Hello Hussein,

See http://support.jetbrains.com/kb/entry.jspa?categoryID=22&externalID=57.

Hi.

I'm developing a web application using Hibernate, Spring and WebWork.

My tools are IntelliJ6 and Tomcat5.0.28

I want to set some break points in my actions and DAOs.

How to use the debugger while the application is running under Tomcat
?

What is Tomcat local and Tomcat remote in Debug tab ?

I did the following :

- Creating Tomcat remote configuration

- I double clicked at Tomcat monitor, Java tab, adding the following
line to

Java Options panel.

(I copied this line from what IntelliJ gave me)

 
> -Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,address=2470,suspend=n,server=y
> 
> ]]>


- I pressed "Debug" button but I got a connection exception.

So, would you mind telling me to use IntelliJ and Tomcat to debug (an
order list of required steps) ?

Thanks.



0
Comment actions Permalink

Well, I don't use IntellJ structur for web module.
I don't have an exploded directory for the application, I create a war
and deploy it in Tomcat.
With the project property console, I set the exploded directory
to :
F:\Apache\Tomcat\webapps\Shopping
But again, I got connection refused exception.
What to do ?
Thanks alot for your time.

0
Comment actions Permalink

Hello Hussein,

You must edit catalina.bat that can be found on

%CATALINA_HOME%/bin

add these lines after the :doRun statement


Make sure that port 8000 is available, if not you can change it.
After modifying, save the file then type "catalina run" to run tomcat.

You can now configure your debug to listen to port 8000.

Br,
Carlos

Message was edited by:
Carlos Lising Jr.

0
Comment actions Permalink

Thanks alot, it working now like a diablo !
What is the difference between the Local configuration and the Remote one ?
Thanks again for help. :)

0
Comment actions Permalink

Hello Hussein,

I'm glad I could help.

Local/Remote refers to the server instance. For example, Tomcat Server > Remote means your tomcat server runs on a remote machine rather than your local machine.

Br,
Carlos

0
Comment actions Permalink

That's not quite true.

Local means that your Tomcat server is started/stopped directly from
within IDEA and IDEA takes care of setting the correct debugging parameters.

Remote means that your Tomcat server is running independently from IDEA
and IDEA is connecting to it using the debug parameters you specified
manually. The 'remote' Tomcat server may very well run on the local machine.

Carlos Lising Jr. wrote:

Hello Hussein,

I'm glad I could help.

Local/Remote refers to the server instance. For example, Tomcat Server > Remote means your tomcat server runs on a remote machine rather than your local machine.

Br,
Carlos


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

I have no problem using Tomcat Local configuration, but the Remote config is not working.
First I run Tomcat after setting debugging information in catalina.bat
Then configured IntelliJ to use the Remote config and I set the port as the one at catalina.bat
When I press the "Debug" button, I get connection refused exception
Why ?

0
Comment actions Permalink

Hello Hussein,

On Server Tab, the port field refers to the port used by your tomcat server. By default it's value is 8080.

On Startup/Connecion Tab > Debug, the port field there should contain the port specified on your catalina.bat.

Br,
Carlos

0
Comment actions Permalink

1. As configured catalina.bat as you told me.
2. I run the server
3. I modified Tomcat Remote configuration to my debug port 5555
4. I pressed "Debug" button but I got connection refused exception.

0
Comment actions Permalink

Hello Hussein,

Inside Tomcat Remote Configuration there are several tabs. On which tab are you modifying the port field? On the "Server" tab or on the "Startup/Connection" tab?

Br,
Carlos

0
Comment actions Permalink

On the "Startup/Connection" tab.
Here is my catalina.bat do run

I didn't change any thing in Tomcat at all except this doRun
IntelliJ shows a long line (something like -Xdebug .....) and suggest to use it.
Where to copy and past it ?

Message was edited by:
Hussein Baghdadi

0
Comment actions Permalink

Hello Hussein,

Actually, setting those 3 variables will run catalina using these settings of the jvm
"-Xdebug -Xrunjdwp:transport=dt_socket,address=5555,server=y,suspend=n" (which is more or less the same as the one specified by IntelliJ).

By looking at your script above, it seems that it is bypassing the variable settings so could you please try modifying your script into these:


This should work now, but if you still have problems please let me know and I'll help you to figure it out.

Br,
Carlos

Message was edited by:
Carlos Lising Jr.

0
Comment actions Permalink

Well, I still get connection refused exception.

0
Comment actions Permalink

Hello Hussein,

You have to make sure before you press the debug the tomcat is up and running.

Can you post all your run/debug settings and the error here?

Thanks.

Br,
Carlos

0
Comment actions Permalink

>> You have to make sure before you press the debug the tomcat is up and running.
Yes, sure.

You suggested to made modifications to :doRun , but this causes problems.
I really appreciate your kind help.

Message was edited by:
Hussein Baghdadi

0

Please sign in to leave a comment.