1 Reply Latest reply on Oct 12, 2004 9:47 AM by Adrian Brock

    ClassCastException on SpyXAConnection.createSession

    Gerald Quintana Newbie

      Hello,

      Here is what I wrote in a MDB Bean for JBoss 4.0:
      InitialContext jndiContext=new InitialContext();
      XAConnectionFactory xaConnectionFactory=(XAConnectionFactory)
      jndiContext.lookup("java:comp/env/jms/XAConnectionFactory");
      Queue queue=(Queue)jndiContext.lookup("java:comp/env/jms/Queue");
      XAConnection xaConnection=xaConnectionFactory.createXAConnection();
      Session session=
      xaConnection.createSession(true,Session.AUTO_ACKNOWLEDGE);

      With
      java:comp/env/jms/XAConnectionFactory => XAConnectionFactory
      java:comp/env/jms/Queue => queue/MyQueue

      Simple no? But I get a ClassCastException:
      java.lang.ClassCastException
      at org.jboss.mq.SpyXAConnection.createSession(SpyXAConnection.java:72)
      at MyBean.onMessage(MyBean.java:xx)

      Who can tell me what's wrong?
      Gerald