Tip #9 - Advanced Debugger Attach
By ByronNevins on Sep 28, 2011
GlassFish has server-side commands, for instance create-instance, that in-turn call the client side. It generally does this by calling asadmin's cousin:
with the command.
But what if you need to debug the spawned client JVM? Impossible? No! Trivial!
Simply do this:
edit nadmin (or nadmin.bat if you are using Windows) and add the java debugging args.
Now simply run the server-side command and then leisurely attach a debugger to port 1234 (make sure you have a breakpoint waiting or you'll miss out).
If you use NetBeans you can easily debug both server and client at the same time.
Don't forget to undo nadmin when you are done!