ActiveMQ连接,未知数据类型:49

时间:2016-02-09 10:09:35

标签: jms activemq ioexception consumer

我正在使用ActiveMQ将文件从应用程序发送到另一个应用程序,当消费者尝试在ActiveMQ服务器上连接时,我遇到了这个错误。

这是连接方法

public void connect()
    {
        connectionFactory = new ActiveMQConnectionFactory(
                "tcp://" + Configuration.getInstance().getServerAddress() + 
                ":61616?jms.blobTransferPolicy.defaultUploadUrl=" + "http://" +
                Configuration.getInstance().getServerAddress() + ":8161/fileserver/"
                        + "&connectionTimeout=0&soTimeout=0&soWriteTimeout=0"
                        + "&useInactivityMonitor=false");
        try 
        {
            connection = connectionFactory.createConnection();
            session = (ActiveMQSession) connection.createSession(false,
                                                    Session.AUTO_ACKNOWLEDGE);  
            destination = session.createQueue(Configuration.getInstance().getQueueName());
            consumer = session.createConsumer(destination);
            connection.start();
//          System.out.println("Consumer connected");
        } catch (JMSException e) {
            logger.error("PACS", e);
            e.printStackTrace();
        }
    }

这与我用于将生产者连接到ActiveMQ的方法完全相同,在这种情况下它完美地工作,在消费者方面我有以下错误:

javax.jms.JMSException: Unknown data type: 49
        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSuppo
rt.java:54)
        at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnect
ion.java:1417)
        at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(Activ
eMQConnection.java:1522)
        at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnecti
on.java:328)
        at com.kratossrl.pacs.consumer.CloudPacsConsumer.connect(CloudPacsConsum
er.java:74)
        at com.kratossrl.pacs.consumer.CloudPacsConsumer.start(CloudPacsConsumer
.java:91)
        at com.kratossrl.pacs.consumer.CloudPacsConsumer.run(CloudPacsConsumer.j
ava:135)
        at com.kratossrl.pacs.consumer.CloudPacsConsumer.init(CloudPacsConsumer.
java:57)
        at com.kratossrl.pacs.consumer.CloudPacsConsumer$1.call(CloudPacsConsume
r.java:39)
        at com.kratossrl.pacs.consumer.CloudPacsConsumer$1.call(CloudPacsConsume
r.java:1)
        at javafx.concurrent.Task$TaskCallable.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: Unknown data type: 49
            at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireForma
    t.java:348)
            at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.
    java:268)
            at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTranspo
    rt.java:221)
            at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.jav
    a:213)
            at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:
    196)
            ... 1 more
    javax.jms.JMSException: Unknown data type: 49
            at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSuppo
    rt.java:54)
            at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnect
    ion.java:1417)
            at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(Activ
    eMQConnection.java:1522)
            at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnecti
    on.java:328)
            at com.kratossrl.pacs.consumer.CloudPacsConsumer.connect(CloudPacsConsum
    er.java:74)
            at com.kratossrl.pacs.consumer.CloudPacsConsumer.start(CloudPacsConsumer
    .java:91)
            at com.kratossrl.pacs.consumer.CloudPacsConsumer.run(CloudPacsConsumer.j
    ava:135)
            at com.kratossrl.pacs.consumer.CloudPacsConsumer.init(CloudPacsConsumer.
    java:57)
            at com.kratossrl.pacs.consumer.CloudPacsConsumer$1.call(CloudPacsConsume
    r.java:39)
            at com.kratossrl.pacs.consumer.CloudPacsConsumer$1.call(CloudPacsConsume
    r.java:1)
            at javafx.concurrent.Task$TaskCallable.call(Unknown Source)
            at java.util.concurrent.FutureTask.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    Caused by:

 java.io.IOException: Unknown data type: 49
        at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireForma
t.java:348)
        at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.
java:268)
        at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTranspo
rt.java:221)
        at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.jav
a:213)
        at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:
196)
        ... 1 more

我在网上寻找此错误,但我没有找到'49'值。

任何人都遇到过我的情况或知道这个问题的原因/解决方案吗?

感谢您的建议并抱歉我的英语不完美

1 个答案:

答案 0 :(得分:0)

仔细检查您的ActiveMQ版本,几乎看起来客户端比服务器更新,当他们正在协商协议时,客户端会发送服务器无法理解的内容并抛出异常