views:

1004

answers:

3

I wanted to set up remote debugging from Eclipse. Tomcat is running as a service on windows.

That bit is fine, a quick google pointed me towards the correct settings to add to wrapper.conf to enable this. There were entries already in wrapper.conf, so I copy/pasted the last entry and modified it:

wrapper.java.additional.8="-Djava.endorsed.dirs=C:/Program Files/OurApp/tomcat/common/endorsed"
wrapper.java.additional.8.stripquotes=TRUE
wrapper.java.additional.9="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n"
wrapper.java.additional.9.stripquotes=TRUE

It didn't work, because the quotes are around everything, and the stripquotes only applies to linux systems.

Theoretically the correct entries should be:

wrapper.java.additional.8=-Djava.endorsed.dirs="C:/Program Files/OurApp/tomcat/common/endorsed"
wrapper.java.additional.8.stripquotes=TRUE
wrapper.java.additional.9=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n

The second example doesn't need quotes - no spaces to break it up. The first example does - because of "Program Files" Am I correct in this assessment?

If so, how/why is the application working as is? There are several parameters ostensibly being set like this (nested in qutoes), which I believe actually have no effect.
For instance min/max memory settings.

I found an example here that has the same thing, ostensibly being a config for windows and linux.

My questions: Will these quotes stop the config commands going through?
Why is the app working if that is the case?

A: 

I'm using remote debugging in Eclipse via *.bat files. Possible it will be more easy way for you.

Steps to accomplish:

  1. Download tomcat installation in zip file and copy all files to bin folder
  2. Create debug.bat file with such content as

    set JPDA_ADDRESS=8000

    set JPDA_TRANSPORT=dt_socket

    call catalina.bat jpda start

If you'll got an error that the port already in use, change 8000 to any other (8001, 8002 etc.).

From Eclipse side:

  1. Open Debug Dialog
  2. New Remote Java Application (Connect tab: Host - localhost or any other ip address, Port - 8000; Source tab:Add all source files (e.g. remove all, add Java project, select all projects)
  3. Push Debug
  4. Set breakpoints in Eclipse and try to reach them from Tomcat
FoxyBOA
Yes, useful information for bypassing the issue.However it doesn't really help me.My concerns are more about the configuration, because the same config is out on production sites. In this case I want to resolve the issue rather than ignore/bypass it.
evnafets
+1  A: 

AFter a bit more playing around and trolling through debug logs, I think I have isolated the issue. The problem was the mix of 1 - Being lazy and putting two configuration items on the same line. (In my defense I copied it as one line from the Tomcat FAQ 2 - Using quotes

The combination of these two was causing the issue.

wrapper.java.additional.9="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n"
wrapper.java.additional.9.stripquotes=TRUE

Like this it generates a command line:

java "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n" ...

It treats that entire string as one argument - rather than the two as I intended.

Without the quotes wrapper.java.additional.9=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n wrapper.java.additional.9.stripquotes=TRUE It generates:

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n ...

Seeing as there are no quotes to screw things up, it processes the two -X parameters as I would want it to. Even better (and probably the intended use) as two seperate entries

    wrapper.java.additional.9="-Xdebug" 
    wrapper.java.additional.9.stripquotes=TRUE
    wrapper.java.additional.10="-Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n"
    wrapper.java.additional.10.stripquotes=TRUE

java "-Xdebug" "-Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n" ...

There are quotes around each one, and it treats them individually. The existing entries are all fine, because they only set one item per line.

So I'll just put this down to a learning experience (sigh) and realise that I now know a whole lot more about wrapper.conf that I didn't know before.

Cheers, evnafets

evnafets
A: 

If you're still looking for another solution, I'd have shot for tomcat6w.exe, the dialog application to configure a windows service (available in tomcats bin directory). I believe there's some options available to set jvm parameters as you said. These options will go to the registry, configuring the service.

Olaf