I am using jdk1.6 update 12 and JBoss 5.1.I am running JBoss and connecting with VisualVM in order to monitor and profile JBoss.Both JBoss and VisualVM are running on my local machine.I am able to monitor JBoss but when I am trying to profile it the system is getting hanged and after some time VisualVM is asking the application is not responding.And asking to stop profilling.I'm able to profile my sample console application via VisualVM.

VisualVM is not a good tool to use to monitor JBoss AS. VisualVM places a load on JBoss AS and generates a lot of garbage (causing strain on the garbage collector). You would be better off using either JConsole or jstat, or look into Jopr.