Debugging the Adapter
Perform the following to debug the adapter.
To debug an adapter
1. To use a debugger with your adapter, you must first shut down your Integration Server and start it using a custom start script.
2. Make a copy of your server.bat (or server.sh in a UNIX environment).
3. To edit your file copy to enable debugging, go to the line near the bottom of the file where the server is actually started. It should look similar to this:
1. rem run Integration Server
2. title webMethods Integration Server
3. %JAVA_RUN% -DWM_HOME="%WM_HOME%" -classpath %CLASSPATH%
%IS_PROXY_MAIN% "%IS_DIR%"\bin\ini.cnf %PREPENDCLASSES_SWITCH%
%PREPENDCLASSES% %APPENDCLASSES_SWITCH% %APPENDCLASSES%
%ENV_CLASSPATH_SWITCH% %ENV_CLASSPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9
4. Modify the file so that the debug settings are inserted immediately after the classpath, as follows:
1. set JDPA_ARGS=-Xdebug -Xnoagent -Djava.compiler=NONE
2. set JDWP_ARGS=
-Xrunjdwp:transport=dt_socket,server=y,address=9999,suspend=n
3.
4. rem run integration server
5. title webMethods Integration Server
6. %JAVA_RUN% -DWM_HOME="%WM_HOME%" -classpath
%CLASSPATH% %JDPA_ARGS%
%JDWP_ARGS% %IS_PROXY_MAIN% "%IS_DIR%"\bin\ini.cnf
%PREPENDCLASSES_SWITCH% %PREPENDCLASSES% %APPENDCLASSES_SWITCH%
%APPENDCLASSES% %ENV_CLASSPATH_SWITCH% %ENV_CLASSPATH% %1 %2 %3 %4
%5 %6 %7 %8 %9
5. Restart your server using the modified start script.
You should be able to attach to Integration Server and "step" your code (assuming you compiled your code to include debug symbols (for example, javac -g) ) using your favorite debugger. The following is a start script for connecting to Integration Server using JDB:
1. rem @echo off
2. set TARGET="C:\Program
Files\webMethods6\IntegrationServer\packages\WmTest1Adapter\code\
source"
3.
4. set JAVA_MIN_MEM=64M
5. set JAVA_MAX_MEM=64M
6. set JAVA_MEMSET=-ms%JAVA_MIN_MEM% -mx%JAVA_MAX_MEM%
7. set JAVA_DBG="C:\Program Files\Java\j2sdk1.3.1_08\bin\jdb"
8. set ARGS=com.sun.jdi.SocketAttach:hostname=localhost,port=9999
9.
10. %JAVA_DBG% -sourcepath %TARGET% -connect %ARGS%