• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • 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 ...
 
Saloon Keeper
Posts: 4701
117
  • Mark post as helpful
  • send pies
  • 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).
 
Bartender
Posts: 19668
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!