Author Topic: Debugging JSPs, Servlets with VS 10.0.3 ( Windows ) and Tomcat 6  (Read 3864 times)

tinker123

  • Community Member
  • Posts: 93
  • Hero Points: 3
Hi;

I found these directions for how to use VS to debug a JSP running on Tomcat:

From:
http://www.devx.com/webdev/Article/31562/1954


Quote
1. Stop Tomcat, and then modify Tomcat's startup script catalina.bat (located in the bin directory under the Tomcat main directory) adding the following JVM arguments to enable remote debugging when you restart Tomcat.

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

 2. After Tomcat is running, click the Debug menu option in SlickEdit and select Attach Debugger—> Attach to Java Virtual Machine. (Note: SlickEdit also has the capability of remotely debugging a .NET program).


When you've configured the debugger, you can set break points in the source code and debug the program. By using the SlickEdit debugger Java programmers can both look at their code in run-time mode as well as refactor it. Figure 3 shows a screenshot of the debugger window with a breakpoint set in the servlet class.   

My problem is that my company does not have Tomcat set up on our test server the same way the person who wrote these directions has Tomcat set up.

On our test server with have just one copy of Tomcat with each project running in its own JVM( which we can turn on or off as a Windows XP Service )

There is just one catalina.bat file for everyone in the one copy of Tomcat.

Is there another way to feed the java args called for above to my instance of Tomcat for my project without altering Tomcat for everyone else?

Thanks in advance for any info




jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: Debugging JSPs, Servlets with VS 10.0.3 ( Windows ) and Tomcat 6
« Reply #1 on: October 23, 2008, 08:29:05 pm »
Have a look in catalina.bat. There are a number of environment variables you can set that affect options passed to the "java" command when starting Tomcat. Notably, JAVA_OPTS and CATALINA_OPTS.

So for example you can try:
Code: [Select]
  SET JAVA_OPTS="-Xdebug -Xrunjdwp:server=y, transport=dt_socket,address=4143,suspend=n --ea"
before you run catalina.bat.

As an aside, why can you not install your own Tomcat on your machine? Tomcat is a pretty small piece of software and very lightweight. It's common practice for each developer to run his own Tomcat for testing and debugging, regardless of what test servers you have in your company.

Regards

John Hurst
Wellington, New Zealand