I got solution to the above problem.
The problem is due to the fact that the jms configuration is in /deploy/jms folder in JBoss 3.2.1.
By default the deploy folder is parsed first for deployments and then its subfolders.
So my EAR is deployed before the JMS implementation.
To get rid of this problem I changed the value of RecursiveSearch to true in conf/jboss-service.xml i.e