Java 发布到ActiveMQ上的主题
我在使用java发布到ActiveMQ上的JMS主题时遇到问题。我的代码非常基本,但我遇到了一个错误。当我尝试发送消息时,问题似乎出现了:Java 发布到ActiveMQ上的主题,java,jms,activemq,Java,Jms,Activemq,我在使用java发布到ActiveMQ上的JMS主题时遇到问题。我的代码非常基本,但我遇到了一个错误。当我尝试发送消息时,问题似乎出现了: ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection(); connec
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection();
connection.start();
ActiveMQSession session = (ActiveMQSession) connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
Topic topic = ((TopicSession) session).createTopic(subject);
ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(topic);
ActiveMQTextMessage txtmessage = (ActiveMQTextMessage) session.createTextMessage();
txtmessage.setText(readFileAsString("foo.txt",null));
producer.send(txtmessage);
Producer.send未发送文本消息,我收到以下错误:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.activemq.ActiveMQMessageProducerSupport.getDestination()Ljavax/jms/Destination;
NoSuchMethodError
总是表示您的客户端类路径中有错误版本的客户端jar(更低版本(或更高版本)。@JimGarrison:我认为如果jar根本不存在,我认为这将是ClassNotFoundException,不是吗?如果可能的话,你能提供任何参考来支持你的评论吗?
java.lang.NoSuchMethodError: org.apache.activemq.ActiveMQMessageProducerSupport.getDestination()Ljavax/jms/Destination;