I can think of two possible problems. One is you import declarations, that you actually use the wrong class/interface. The other problem could be a class loader problem. When the MQ classes are in a different classloader than the JMS API. Are you sure it is a SpyTextMessage?
Thanks Bernd, you were correct. I had a geronimo-jms jar in a war.