title: javax.naming.NamingException: Cannot create resource instance of ActiveMQConnectionFactory
body: <p>I know that this question has been asked many times, but I still have an exception even after following all the answers. My configs are:</p>
  
  <p>context.xml</p>
  
  <pre><code>&lt;Context&gt;
       &lt;Resource
        name="jms/ProdConnectionFactory"
        description="Prod JMS Connection Factory"
        auth="Container"
        userName="" 
        password=""
        type="org.apache.activemq.ActiveMQConnectionFactory"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory"
        brokerURL="tcp://jmshost:61616"
        brokerName="ProdActiveMQBroker"
     /&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;web-app&gt;
      &lt;resource-ref&gt;
          &lt;description&gt;Prod Connection Factory&lt;/description&gt;
          &lt;res-ref-name&gt;jms/ProdConnectionFactory&lt;/res-ref-name&gt;
          &lt;res-type&gt;org.apache.activemq.ActiveMQConnectionFactory&lt;/res-type&gt;
          &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;/resource-ref&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Java code:</p>
  
  <pre><code>Context context = new InitialContext();
  ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) context.lookup("java:comp/env/jms/ProdConnectionFactory");
  </code></pre>
  
  <p>And the exception that I receive is:</p>
  
  <pre><code>javax.naming.NamingException: Cannot create resource instance
          at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
          at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
          at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
          at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
          at javax.naming.InitialContext.lookup(InitialContext.java:392)
  </code></pre>
  
  <p>Can anyone take a look and let me know where I'm wrong. Thanks</p>
  
  <p>L</p>