2 Replies Latest reply on Apr 5, 2002 6:56 PM by hackerdude

    (TemporaryTopic) msg.getJMSReplyTo() throws java.lang.ClassC

    rleiwang

      Hi folks,

      I had developed one MDB that would send pre-processing result back to the client.

      In the MDB, it would execute the following line to get
      the reply topic that created by the client

      TemporaryTopic replyTopic = (TemporaryTopic) msg.getJMSReplyTo();

      This part works fine on Weblogic. On JBoss 2.4.4,
      exception had been thrown as below, line 55 is shown above:

      java.lang.ClassCastException: org.jboss.mq.SpyTopic
      at com.xporta.deniedparty.ejb.DPSBatchBean.onMessage(DPSBatchBean.java:55)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:406)
      at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:81)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
      at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:281)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:584)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:930)
      at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:233)
      at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:565)
      at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:376)
      at org.jboss.mq.SpySession.run(SpySession.java:248)
      at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:172)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:725)
      at java.lang.Thread.run(Thread.java:484)

      Any ideas?

      Thanks in advance

        • 1. Re: (TemporaryTopic) msg.getJMSReplyTo() throws java.lang.Cl
          lorensrosen

          Where and how are you doing the corresponding
          setJMSReplyTo? Can you try the

          TemporaryTopic replyTopic = (TemporaryTopic) msg.getJMSReplyTo();

          immediately after the setJMSReplyTo() call?

          Another instructive thing would be to
          take a look at the String
          msg.getJMSReplyTo().getClass().getName()

          • 2. Re: (TemporaryTopic) msg.getJMSReplyTo() throws java.lang.Cl
            hackerdude

            Change your getJMSReplyTo() line to read:


            Destination replyDestination = message.getJMSReplyTo();
            Topic replyTopic = (Topic)replyDestination;


            and it should go okay (at least it does under 2.4.4). It would probably also work under WebLogic. For compatibility, if you have explicitly to call delete() on temporaryTopic under Weblogic (I don't know if you do or if you should) you could use an instanceof and cast only if it is indeed a temporarytopic.


            Now the question is, why is it creating Topic instead of TemporaryTopic? Does anybody know? Does it matter?