How to debug Java Service

I’m using version 8.2 and want to single step through my Java Service and examine my variables. I put a breakpoint at the beginning of the service, but it never stops there.

What else do you have to do?

Alas, stepping through a Java service cannot be done.

In developer, it is not possible to trace the Java service. But, what you could do is use System.out.println() to write values of variable to the console at the breakpoints.

Regards,
Shriraksha A N

Debugging of Java services can only be outside webMethods with a Java IDE.
You can use the debugging of Developer to find out which values have been passed to the service and then debug externally.
For Java services of a higher complexity it may be of advantage to bundle them in a JAR which is developed and tested outside webemethods and then inject the jar to the webMethods package, only having small wrapper services written in webMethods itself which call the methods contained in the jar.

Regards

Martin

By using webMethods Designer (eclipse) you can do several steps:

  1. You need to create a java class which is serves as called “Test Harness”, first of all to make your work lot easier, do this by changing your eclipse perspective to JavaEE.

  2. Right click on your javaService working window which you want to generate a test harness, and click to Generate Code. In the Code Generation window, choose “For debugging this service” option and click Finish.
    Designer generates the test harness with a single main primary method and displays it in the debugger editor. (picture #1)
    Optionally update the “Test Harness” class param as necessary to which the test harness will connect to. For instance: change the server name, username & password entry
    Save for any change(s) you’ve made.

  3. Select breakpoint(s) on your javaService earlier (picture #2), and back again select your TestHarness java class and click on debug (or right-click for debug as java application).

  4. When you launch the Java class in debug mode and the debugger encounters a breakpoint, it suspends execution. At that time, if the Debug perspective is not already in use, Designer switches to it (picture #3)

This is it! Finally you can debug your Java Services in Designer (eclipse)

Source: 8-2-SP3_Service_Development_Help.pdf page 367 (SoftwareAG webMethods documentation)



2 Likes

Ivan thanks for your effort and time.

You may also view this video http://techcommunity.softwareag.com/ecosystem/communities/protected/webmethods/products/esb_and_integration/demo/links/editing_debugging_java_services

Its interesting :slight_smile:

hi all,

we are using wm9.6 (with no fixes applied)

i did follow the service development guide (debugging java services).

  1. stopped integration server
  2. i changed the <SOFTWAREAG_HOME>/IntegrationServer/instances/default/bin, enabled debug settings
  3. restarted integration server as application

unfortunately when restarted, i dont see any log ‘debug enabled’ or i dont see the port 9191 in the IS admin -> security ports.

any clue, whats missing, i strictly followed the instructions given in service development guide

any help is appreciated. i appreciate if only guys who did it successfully respond

thanks and regards
ajay kumar kasam

Is this a fresh install of 9.6 and you are trying to bring up?

How are you starting the IS from Services thru and did you monitor the default/logs anything getting updated or stuck?

HTH,
RMG

for now, all i’m trying to see 9191 port and debug enabled when i start my IS (after enabled debug in the setenv.bat)

yes its normal install, normal way of starting the IS using startup.bat, normal way of starting the services.

Ajay – Did you fix the issue or still looking for assistance. I am not quite clear with your earlier statements.

Thanks,

What OS are you running your IS in? In Windows specifically, after changing setenv.bat, you have to run server.bat -service . E.g.:

server.bat -service sagis96_2.default

This should update your Tanuki wrapper config with those new JVM parameters. Before the Tanuki wrapper was introduced, this used to update the Windows registry from where the Windows service would pull the information.

I hear in 9.9, this method was retired. All changes now are done directly in the Tanuki wrapper custom config file.

Percio

for me issue is resolved

i’m using wm9.6 (windows)

i’ve just followed service development guide (debugging java services)

summary

  • change setenv.bat), make debug_enabled=true
  • restart Integration server (in my case, running as console application)
  • verified the wrapper.log (located in profiles/IS_default/logs folder (searched for 9191 debug port)
  • on designer
    • in java perspective, create java application, with IS/instances/default/package/
    • created remote java application debug configuration, set the IS host(localhost) and debug port (9191)
    • open the java project, java service to debug, set the breakpoint
  • to test, i have written flow service which invokes the java service i wanted to debug. just run the flow service
  • yes the java service stops its execution where i set breakpoint

thanks a lot