title: How will I send messages to Activemq
body: <p>I never work on <code>JMS</code>. Recently I downloaded <code>Activemq</code> and changed port no from <code>61616</code> to <code>61617</code> in all <code>conf/activemq-*.xml</code> files.I run the following command from command prompt and open console page on browser.</p>
  
  <pre><code>  C:\Users\Infratab Bangalore\Desktop\Queueing\apache-activemq-5.8.0\bin&gt;activemq
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/OY8Bt.png" alt="enter image description here"></p>
  
  <p>Now I want to send messages from java code using <code>JMS</code> to <code>Activemq</code>.For this I wrote the following code. And run my code using Apache Tomcat server.it's not working</p>
  
  <p>This code is implemented in Eclipse.</p>
  
  <pre><code>package PackageName;
  
  import java.io.IOException;
  import javax.jms.Connection;
  import javax.jms.ConnectionFactory;
  import javax.jms.Queue;
  import javax.jms.Session;
  import javax.jms.TextMessage;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.activemq.ActiveMQConnectionFactory;
  
  public class MessageProducer extends HttpServlet {
      @Override
      protected void service(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
          try {
              //created ConnectionFactory object for creating connection 
              ConnectionFactory factory = new ActiveMQConnectionFactory("admin", "admin", "tcp://localhost:61617");
              //Establish the connection
              Connection connection = factory.createConnection();
              Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
              Queue queue = session.createQueue("Test");
              //Added as a producer
              javax.jms.MessageProducer producer = session.createProducer(queue);
              // Create and send the message
              TextMessage msg = session.createTextMessage();
              msg.setText("TestMessage");
              producer.send(msg);
          } catch (Exception e) {
              // TODO: handle exception
          }
      }
  }
  </code></pre>
  
  <p>I am getting the following error</p>
  
  <pre><code> java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
  org.apache.activemq.ActiveMQPrefetchPolicy.&lt;clinit&gt;(ActiveMQPrefetchPolicy.java:30)
  org.apache.activemq.ActiveMQConnectionFactory.&lt;init&gt;(ActiveMQConnectionFactory.java:88)
  PackageName.MessageProducer.service(MessageProducer.java:20)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
  </code></pre>
  
  <p>can you suggest me, where I wrote wrong.</p>
  
  <p>Thanks.</p>