Since you have it embedded, you have to call server.stop before you stop your application, otherwise HornetQ will have threads running.
You could add a shutdow hook maybe? just a simple server.stop() on the shutdown hook (look on the javadoc for more information)
Yes I know the server must be stop, this is what I do in my LoaderServlet (its initialize and destroy my webapp).
I have attached this class, but I think it's a problem of locking the hornetq-configuration.xml file, because when
I try to delete my webapp directory under tomcat/webapps/ only this file is present while all others were deleted.
A configuration that was used to load the server, it must be unloaded?
I also try to kill threaddump but nothing, 2, 3 thread remains active ... (look threaddump.log)
You don't need to use xml file to configurate your hornetq. You can try whether this helps.
No sorry I need to use xml file, because our configuration is here.
These two Threads belong to the globalThreadPool created for the clients. You can configure the ServerLocator to not use a global Thread pool through the propery useGlobalPools = false, however these threads are daemon threads and they shouldn't block the shutdown of your server. It must be something else.
Look at the thread dump from the VM instead. That method you used is meant to be used within the application when crashes are about to happen.