• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

How do I edit catalina.bat to make remote debugging work ?

 
Ranch Hand
Posts: 1049
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi experts,

After failing to use the normal debugging method to debug my web project which consists of jsp and servlet etc, I have decided to try remote debugging.

The thing is that I am not familiar with remote debugging.

I have tomcat v 9.0.4 x64 version for Windows 10 'embedded' inside Eclipse.

After doing some research on the internet, I realised I have to add in this line as per https://stackoverflow.com/questions/3835612/remote-debugging-tomcat-with-eclipse


ATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"



However, when I open up my catalina.bat it has very strange 'language' such that I am not sure how to go about adding the said line.

Here's how my catalina.bat looks like :



I hope someone can tell me what should I do now in order to add in the line and anything I should be aware of in order to make my debugger works...

It's been 2 months already...I think will it take me forever or the things are forcing me to give up ...
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not "strange language"; it's a Windows batch file. YOu probably don't need to change that at all, you just need to start it with "catalina.bat jpda start" instead of "catalina.bat start". I don't use the Eclipse integration, so can't say how that interacts, but I'd think that Eclipse has options to run Tomcat in debug (a.k.a. jpda) mode. If it doesn't, run Tomcat independently of Eclipse (which is what I advise anyway).
 
Saloon Keeper
Posts: 28713
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To reinforce what Tim Moores said, you don't have to change anything in the catalina.bat file. Just launch it with the "jpda start" command options.

You can override what port and other options JPDA will use by setting the appropriate environment variables, but usually you will not want to do that.

In Eclipse, create a Remote Debugging profile off the run/debug menu and set the target port and hostname to point to the instance of Tomcat running under JPDA. The default port is 8000.

Don't set any debugging options in the CATALINA_OPTS or setenv.bat (if you're using one). Everything you need is in the JPDA script options.

You have the option to start Tomcat in a paused state so that the debugger can connect before Tomcat starts (using the debugger resume command), or have Tomcat start normally and connect on the fly. Unless you need to debug stuff that's in initialization code, it's usually easier to leave it unpaused, but that's up to you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic