Debugging
How to use Netbeans debugger when your code is running in the Windchill® Method Server?

In order to specify that a debugger can be attached to the process, we need to add the following option to the Method Server Java command :

-Xrunjdwp:transport=dt_socket,server=y,address=Port,suspend=y or n

For this How To, let’s choose the port 8000, and let’s say that the MethodServer should not wait for debugger attachement (suspend=n), the option will looks like this :

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

Start a Windchill® shell and execute :

xconfmanager -s wt.manager.cmd.MethodServer.debug.args=
-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n -p

Start Apache/Tomcat/Method server, under Netbeans you can now attach the debugger to the method server by selecting “Attach Debugger…” under the “Debug” menu (using the parameters specified in the property file) :

Windchill Method Server Netbeans debug

You may also debug in Tomcat, on 9.1, by updating the batch file that starts tomcat (Note that Tomcat is embedded from release 10)

w:/ptc/Tomcat/bin/wttomcat_start.bat

And add the following line.

rem Add debugging
set JAVA_OPTS=%JAVA_OPTS%

-Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=n
Note the different port number to allow use to debug in the MS and the Tomcat in the same session
wt.manager.cmd.MethodServer.debug.args