Reputation: 25
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
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