ClassCastException while importing messages from a hornetq-journal file.

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6.4.8
    • HornetQ Importer tool org.hornetq.jms.persistence.impl.journal.XmlDataImporter

Issue

When executing the HornetQ importer tool, the following exception is thrown. The problem is triggered by queues with ID > max Integer. These IDs cause the ClassCastExceptions.

Examples
queue id 2147483667 - ClassCastException
queue id 54 - Ok
queue id 2147483673 - ClassCastException
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
        at org.hornetq.jms.persistence.impl.journal.XmlDataImporter.sendMessage(XmlDataImporter.java:389)
        at org.hornetq.jms.persistence.impl.journal.XmlDataImporter.processMessage(XmlDataImporter.java:329)
        at org.hornetq.jms.persistence.impl.journal.XmlDataImporter.processXml(XmlDataImporter.java:225)

Resolution

The issue is known issue Red Hat is looking to address in EAP 6.4.0 CP11
Ref : This content is not included.This content is not included.https://bugzilla.redhat.com/show_bug.cgi?id=1375295

Root Cause

The queueId delivered by the HornetQ-Management is of type Long, however it is being cast to an Integer which leads to the ClassCastException

Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.