Oliver Scholz created ARTEMIS-2922:
--------------------------------------

             Summary: artemis-cli consumer on large message results in a 
ClassCastException
                 Key: ARTEMIS-2922
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2922
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: ActiveMQ-Artemis-Native
    Affects Versions: 2.15.0
         Environment: OS: Ubuntu 20.04 lts

jre/jdk: openjdk version "11.0.8" 2020-07-14

The broker has been created with
{quote}bin/artemis create --user admin --password admin --allow-anonymous broker
{quote}
(no changes in the config)

The message is produced with
{quote}artemis producer --data large-test.xml.sav --destination queue://test
{quote}
 
            Reporter: Oliver Scholz
            Assignee: Clebert Suconic
         Attachments: large-test.xml.sav

When i try to consume a Large Message (stored in ../data/large-messages)  with 
the artemis-cli
{quote}{color:#000000}artemis consumer --message-count 1 --data export-test.xml 
--destination queue://test{color}
{quote}
i get an ClassCastException output
{quote}{color:#000000}Connection brokerURL = tcp://localhost:61616{color}

{color:#000000}Consumer:: filter = null{color}

{color:#000000}Consumer ActiveMQQueue[test], thread=0 wait until 1 messages are 
consumed{color}

{color:#000000}java.lang.RuntimeException: java.lang.ClassCastException: class 
org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl cannot be 
cast to class org.apache.activemq.artemis.core.server.LargeServerMessage 
(org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl and 
org.apache.activemq.artemis.core.server.LargeServerMessage are in unnamed 
module of loader java.net.URLClassLoader @18769467){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.factory.serialize.XMLMessageSerializer.write(XMLMessageSerializer.java:74){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.commands.messages.Consumer$SerialiserMessageListener.onMessage(Consumer.java:140){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.commands.messages.ConsumerThread.handle(ConsumerThread.java:73){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.commands.messages.ConsumerThread.consume(ConsumerThread.java:192){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.commands.messages.ConsumerThread.run(ConsumerThread.java:67){color}

{color:#000000}Caused by: java.lang.ClassCastException: class 
org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl cannot be 
cast to class org.apache.activemq.artemis.core.server.LargeServerMessage 
(org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl and 
org.apache.activemq.artemis.core.server.LargeServerMessage are in unnamed 
module of loader java.net.URLClassLoader @18769467){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.commands.tools.xml.XMLMessageExporter.printMessageBody(XMLMessageExporter.java:61){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.commands.tools.xml.XMLMessageExporter.printSingleMessageAsXML(XMLMessageExporter.java:53){color}

{color:#000000} at 
org.apache.activemq.artemis.cli.factory.serialize.XMLMessageSerializer.write(XMLMessageSerializer.java:72){color}

{color:#000000} ... 4 more{color}

{color:#000000}Consumer ActiveMQQueue[test], thread=0 Consumed: 0 
messages{color}

{color:#000000}Consumer ActiveMQQueue[test], thread=0 Consumer thread 
finished{color}
{quote}
Yet, the message was consumed from the queue!

Also a workaround/fix for exporting Large Messages would be great.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to