user3016435
user3016435

Reputation: 25

Unable to Convert the message

I need to add a message header to the meassage which i will push to the Tibco and IBM MQ server. Please find below the code :

(TextMessage)message).setStringProperty(rs.getString(2),value);

the above code adds header to message. but when i convert the message i get the below exception

error:com.tibco.tibjms.TibjmsTextMessage cannot be cast to javax.jms.TextMessag

Anyother option to add mesage header to a message is also appriciated.

Upvotes: 0

Views: 2284

Answers (1)

GhislainCote
GhislainCote

Reputation: 1512

Have you tried changing the message variable type from Object type to javax.jms.TextMessage?

Since com.tibco.tibjms.TibjmsTextMessage implements javax.jms.TextMessage, that MAY allow the conversion.

If this answer does not help, please supply more source code and context on the error (stacktrace, EMS message content, etc.)

FYI, this declaration was extracted from the EMS tibjms.jar file:

public class com.tibco.tibjms.TibjmsTextMessage
    extends com.tibco.tibjms.TibjmsMessage
    implements javax.jms.TextMessage, java.io.Serializable, 
               java.lang.Cloneable, com.tibco.tibjms.TibjmsxConst{[...]}

Upvotes: 1

Related Questions