You know someone else that answered my post mentioned activemq-optional. No JAR file with that name was included with my download of ActiveMQ 5.5.0.
Can you tell me where I can get it? I've looked in a few places and can't seem to find one anywhere. I also have a question about your comment on the commons-httpclient. As you can see from my original email I'm including httpclient-4.1.1.jar. I thought this would do the trick. The reason I thought this is because when I looked on the Apache commons site it stated that the commons project was replaced by the components project. It appeared to me that this was the place to get the httpclient JAR I needed. One response seemed to indicate that if I used the activemq-optional JAR I would not need commons-httpclient. Do you know if that is the case? Is there someplace where an exact list of JARs needed is clearly spelled out? The ActiveMQ web site page that contains the list of Required and Optional JARs is not very clear! Thank you. -----Original Message----- From: Johan Edstrom [mailto:seij...@gmail.com] Sent: Saturday, May 21, 2011 1:18 PM To: users@activemq.apache.org Subject: Re: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpMethod Make sure you also have apache-activemq-optional on the clients classpath as well as a http transport defined on the broker, the broker will need the same library for the http transport. Cheers. On May 21, 2011, at 11:11 AM, Michael wrote: > Thanks Johan. I see the URL error. I'll fix it and give it another try! > > -----Original Message----- > From: Johan Edstrom [mailto:seij...@gmail.com] > Sent: Saturday, May 21, 2011 12:08 PM > To: users@activemq.apache.org > Subject: Re: java.lang.NoClassDefFoundError: > org/apache/commons/httpclient/HttpMethod > > Not sure what you have been reading really, > > But you are trying to use a jms "client/producer" against the activemq > webapp, not a transport, you are also missing commons-httpclient on > the classpath. > > /je > > On May 20, 2011, at 9:09 PM, Michael wrote: > >> I am trying to run a very simple ActiveMQ message producer client. >> The source code is provided below. >> >> >> >> I am launching the app from Eclipse using the Run menu. I have >> configured a Run Configuration For the client app. On the classpath >> tab of the Run Configuration for the app I have included >> activemq-all-5.5.0.jar, >> slf4j-simple-1.5.11 and httpclient-4.1.1.jar. >> >> >> >> When I run the app I get the following stack trace provided below. >> Can anyone tell me what might be wrong? >> >> >> >> Thank you. >> >> >> >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/commons/httpclient/HttpMethod >> >> at >> org.apache.activemq.transport.http.HttpTransportFactory.createTranspo >> r >> t(Http >> TransportFactory.java:75) >> >> at >> org.apache.activemq.transport.TransportFactory.doConnect(TransportFac >> t >> ory.ja >> va:141) >> >> at >> org.apache.activemq.transport.TransportFactory.doConnect(TransportFac >> t >> ory.ja >> va:51) >> >> at >> org.apache.activemq.transport.TransportFactory.connect(TransportFacto >> r >> y.java >> :80) >> >> at >> org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveM >> Q >> Connec >> tionFactory.java:243) >> >> at >> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnectio >> n >> (Activ >> eMQConnectionFactory.java:258) >> >> at >> org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnectio >> n >> (Activ >> eMQConnectionFactory.java:230) >> >> at >> org.apache.activemq.ActiveMQConnectionFactory.createConnection(Active >> M >> QConne >> ctionFactory.java:178) >> >> at >> JMSActiveMQPublisherApp.Execute(JMSActiveMQPublisherApp.java:39) >> >> at JMSActiveMQPublisherApp.main(JMSActiveMQPublisherApp.java:28) >> >> Caused by: java.lang.ClassNotFoundException: >> org.apache.commons.httpclient.HttpMethod >> >> at java.net.URLClassLoader$1.run(Unknown Source) >> >> at java.security.AccessController.doPrivileged(Native Method) >> >> at java.net.URLClassLoader.findClass(Unknown Source) >> >> at java.lang.ClassLoader.loadClass(Unknown Source) >> >> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) >> >> at java.lang.ClassLoader.loadClass(Unknown Source) >> >> ... 10 more >> >> >> >> import java.util.Vector; >> >> >> >> import javax.jms.Connection; >> >> import javax.jms.Session; >> >> import javax.jms.Destination; >> >> import javax.jms.DeliveryMode; >> >> import javax.jms.MessageProducer; >> >> import javax.jms.TextMessage; >> >> >> >> import org.apache.activemq.ActiveMQConnection; >> >> import org.apache.activemq.ActiveMQConnectionFactory; >> >> >> >> public class JMSActiveMQPublisherApp >> >> { >> >> private String user = ActiveMQConnection.DEFAULT_USER; >> >> private String password = ActiveMQConnection.DEFAULT_PASSWORD; >> >> private String url = "http://localhost:8161/"; >> >> private String subject = "Subject.One"; >> >> private int messageCount = 10; >> >> private long sleepTime = 10000; >> >> >> >> >> >> private Destination destination; >> >> >> >> public static void main(String[] args) >> >> { >> >> JMSActiveMQPublisherApp app = new JMSActiveMQPublisherApp( ); >> >> app.Execute(); >> >> } >> >> >> >> public void Execute( ) >> >> { >> >> Connection connection = null; >> >> try >> >> { >> >> // Create the connection. >> >> ActiveMQConnectionFactory connectionFactory = >> >> new ActiveMQConnectionFactory(user, password, url); >> >> connection = connectionFactory.createConnection(); >> >> connection.start(); >> >> >> >> // Create the session >> >> // The argument false indicates that this session is not >> transacted >> >> Session session = >> >> connection.createSession(false, >> Session.AUTO_ACKNOWLEDGE); >> >> >> >> // Note that this method is not for creating the physical > topic. >> >> // The physical creation of topics is an administrative >> task and >> >> // is not to be initiated by the JMS API. >> >> // >> >> // So a publisher can not create new topics. The topics >> must >> >> // be created manually. The publisher can only send >> messages to >> >> // already existing topics. >> >> // >> >> // This appears to be a severely limited implementation of >> the >> >> // publish/subscribe model!!! >> >> destination = session.createTopic(subject); >> >> >> >> // Create the producer. >> >> MessageProducer producer = >> session.createProducer(destination); >> >> producer.setDeliveryMode(DeliveryMode.PERSISTENT); >> >> >> >> // Start sending messages >> >> SendLoop(session, producer); >> >> >> >> >> >> } >> >> catch (Exception e) >> >> { >> >> System.out.println("Exception: " + e.getMessage()); >> >> e.printStackTrace(); >> >> } >> >> finally >> >> { >> >> try >> >> { >> >> connection.close(); >> >> } >> >> catch (Throwable ignore) >> >> { >> >> } >> >> } >> >> } >> >> >> >> private void SendLoop(Session session, MessageProducer producer) >> throws Exception >> >> { >> >> >> >> for (int i = 0; i < messageCount || messageCount == 0; i++) { >> >> >> >> TextMessage message = session.createTextMessage("This is >> message " + messageCount + " for topic Subject.One!" ); >> >> >> >> producer.send(message); >> >> >> >> System.out.println("Message " + messageCount + " sent to >> topic Subject.One"); >> >> >> >> Thread.sleep(sleepTime); >> >> } >> >> } >> >> } >> >> >> > >