Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 发布到ActiveMQ上的主题_Java_Jms_Activemq - Fatal编程技术网

Java 发布到ActiveMQ上的主题

Java 发布到ActiveMQ上的主题,java,jms,activemq,Java,Jms,Activemq,我在使用java发布到ActiveMQ上的JMS主题时遇到问题。我的代码非常基本,但我遇到了一个错误。当我尝试发送消息时,问题似乎出现了: ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url); ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection(); connec

我在使用java发布到ActiveMQ上的JMS主题时遇到问题。我的代码非常基本,但我遇到了一个错误。当我尝试发送消息时,问题似乎出现了:

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;