I attempted to place Apache JNDI for Hornetq based on these blog : http://wash-inside-out.blogspot.com/2010/08/hornetq-jms-integration-with-tomcat.html. but I am getting this error now :

Deployment "Naming" is in error due to: javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory  [Root exception is java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory ]

How you can discover which jar file has that class?

Based on this search result in FindJar, naming-factory-5.5.23.jar is the one which consists of that class. Beware the dependency scope is test within the example you provided. Are you currently doing the research in non test code?