I have a quite difficult problem with one thing in my Java EE application.
I use JoNaS as my application container and my issue is strictly connected with synchronization in it. Is it possible to debug the application within its container? How should I organise my project to achieve that (e.g. where to put JoNaS sources)?
Debugging this will have several components.
My first recommendation is that you use a good IDE, like IntelliJ, to attach to your application and set breakpoints in it.
My second recommendation is to download the latest version of Visual VM, install all the plugins, and point it at your JVM when you run the app. It'll show you heap, threads, CPU, etc.
My third recommendation is to take thread dumps on deadlocks and learn how to interpret them.
Good luck - threading issues are challenging.