All when i send a message from my MDB i get this error come up.

= true, text = null}
16:50:24,949 INFO  [PublishMsgToTopic] Autobahn Monitor.onMessage
16:50:27,965 INFO  [PublishMsgToTopic] Autobahn Monitor.ejbRemove
16:50:27,981 ERROR [LogInterceptor] TransactionRolledbackLocalException in
method: public abstract v
oid javax.jms.MessageListener.onMessage(javax.jms.Message), causedBy:
java.lang.ClassCastException: java.lang.String

my main code is

        public void onMessage(Message message)  {
                if (logger.isInfoEnabled()) {
                        logger.info("Autobahn Monitor.onMessage");
                }
                

                        handleMessage(message);

                
        }
        private void handleMessage(Message message) {
                try {
                        if (message instanceof ObjectMessage) {
                                //TextMessage textMessage = (TextMessage) 
message;
                                ObjectMessage objMsg = (ObjectMessage)message;
                                eventMsg = (MonitorMSG)objMsg.getObject();
                                if (logger.isInfoEnabled()) {
                                        logger.info("Message received: " + 
eventMsg.getHostname());
                                }
                                send(objMsg);
                        } else {
                                if (logger.isInfoEnabled()) {
                                        logger.info("Unknown message type 
received: " + message.toString());
                                }
                                //send("Unknown message type: " + 
message.toString());
                        }
                } catch (JMSException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
        
        private void send(ObjectMessage obj) {
                sendToEJB(obj);
        }
        
        private void sendToEJB(ObjectMessage obj)  {
                PublishToTopic publishtoTopic = new PublishToTopic();
                publishtoTopic.sendMessage(obj);
        } 


Then in the PublishtoTopic class


        public void sendMessage(ObjectMessage obj){
                try {
                        ObjectMessage objMsg = (ObjectMessage)obj;
                        //eventMSG = (MonitorMSG)objMsg.getObject();
                        ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(url);
                        connection = factory.createConnection();        
                        session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
                        topic = session.createTopic("TOOL.TOPICTEST");
                        //control = session.createTopic("topictest.control");
                        
                        publisher = session.createProducer(topic);
                        publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                        
                        
//session.createConsumer(control).setMessageListener(this);
                        connection.start();

                        //request shutdown
                        publisher.send(objMsg);

                        connection.stop();
                        connection.close();
                } catch (JMSException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }    
        }

Am i missing something......




-- 
View this message in context: 
http://www.nabble.com/TransactionRolledbackLocalException-in-method-tf3040921.html#a8452585
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to