I'm trying to get (Oracle Data Integrator 12.1.2.0.0) out of the XML from JMS queue, powered Apache ActiveMQ 5.8, but the following error:
ODI-1227: Task LKM JMS XML to SQL (Load JMS to XML) fails on the source <Empty Value> connection JMS_ActiveMQ_INVOICE_LOCAL2_CNG.
Caused By: java.sql.SQLException: java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to javax.jms.BytesMessage
at com.sunopsis.jdbc.driver.SnpsDriverStatement.executeQuery(SnpsDriverStatement.java:110)
at com.sunopsis.jdbc.driver.SnpsDriverPreparedStatement.executeQuery(SnpsDriverPreparedStatement.java:139)
at com.sunopsis.jdbc.driver.JMSXMLStatement.loadJMS(JMSXMLStatement.java:687)
at com.sunopsis.jdbc.driver.JMSXMLStatement.execute(JMSXMLStatement.java:159)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:205)...
JMS-queue is external system and I am unable to change the type of messages. Can the LKM JMS XML to SQL knowledge module to process messages org.apache.activemq.command.ActiveMQObjectMessage class, that implements the interface javax.jms.BytesMessage, if so, how to config it?
Because the message of the org.apache.activemq.command.ActiveMQTextMessage
class that implements the interface javax.jms.TextMessage
knowledge module LKM JMS XML to SQL is successfully handles.
How do I solve this problem.
Regards, Azamat
I have run into same problem and solved it by adding check for which type of instance is being returned in call.
if (message instanceof ActiveMQTextMessage) {
ActiveMQTextMessage amqMessage = (ActiveMQTextMessage) message;
mqDelegate.execute(params, amqMessage.getText());
} else {
BytesMessage bm = (BytesMessage) message;
byte data[] = new byte[(int) bm.getBodyLength()];
bm.readBytes(data);
mqDelegate.execute(params, new String(data));
}
Let me know if there is a better solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With