2 Replies Latest reply on Jan 14, 2003 3:10 AM by shmulikb

    Error while try to publish an event

    shmulikb

      Hi,
      Im using jboss 3.0.4.
      Im Trying to use jbossmq
      Im getting the following error while publish an event (object):
      11:56:06,031 WARN [OILServerILService] Client request resulted in a server exception:
      javax.jms.JMSException: SELECTOR: EQUAL: Bad object type
      at org.jboss.mq.selectors.Selector.test(Selector.java:186)
      at org.jboss.mq.server.SelectorPersistentQueue.addMessage(SelectorPersistentQueue.java:68)
      at org.jboss.mq.server.JMSTopic.addMessage(JMSTopic.java:265)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:398)
      at org.jboss.mq.server.JMSDestinationManager.addMessage(JMSDestinationManager.java:376)
      at org.jboss.mq.server.JMSServerInterceptorSupport.addMessage(JMSServerInterceptorSupport.java:135)
      at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:155)
      at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:209)
      at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:137)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:248)

      can anyone help ?

      thanks

        • 1. Re: Error while try to publish an event
          cholliday

          It looks like the syntax of your selector statement is bad. What selector statement are you using?

          • 2. Re: Error while try to publish an event
            shmulikb

            here is the nodes of my DurableSubscription in jbossmq-state.xml


            kamoonAppServer
            10017037
            kmEventTopic
            orgID=10012423 and JMSType in ('operations','projects','user-types','stylesheets','groups','statuses')


            the topic name is (in jbossmq-destinations-service.xml file):


            <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
            <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager





            try to work with this simple example:
            package com.km.eventing;

            import javax.jms.*;
            import javax.naming.*;
            import java.io.*;
            import java.io.InputStreamReader;
            import java.util.Properties;

            public class Chat implements javax.jms.MessageListener{
            private TopicSession pubSession;
            private TopicSession subSession;
            private TopicPublisher publisher;
            private TopicConnection connection;
            private String userName;

            /* Constructor. Establish JMS publisher and subscriber */
            public Chat(String topicName, String username, String password)
            throws Exception {

            // ... specify the JNDI properties specific to the vendor
            //env.put("BROKER", "localhost");
            // Obtain a JNDI connection
            Properties env = new Properties();

            InitialContext jndi = new InitialContext(env);

            // Lookup a JMS connection factory
            TopicConnectionFactory conFactory =
            (TopicConnectionFactory)jndi.lookup("ConnectionFactory");

            // Create a JMS connection
            TopicConnection connection =
            conFactory.createTopicConnection();

            // Create a JMS session object
            TopicSession pubSession =
            connection.createTopicSession(false,
            Session.AUTO_ACKNOWLEDGE);
            TopicSession subSession =
            connection.createTopicSession(false,
            Session.AUTO_ACKNOWLEDGE);

            // Lookup a JMS topic
            /* Topic chatTopic = (Topic)jndi.lookup(topicName);

            */
            Topic chatTopic = JMSProvider.getKamoonTopic();

            // Create a JMS publisher and subscriber
            TopicPublisher publisher =
            pubSession.createPublisher(chatTopic);
            TopicSubscriber subscriber =
            subSession.createSubscriber(chatTopic);

            // Set a JMS message listener
            subscriber.setMessageListener(this);

            // Intialize the Chat application
            set(connection, pubSession, subSession, publisher, username);

            // Start the JMS connection; allows messages to be delivered
            connection.start();

            }
            /* Initializes the instance variables */
            public void set(TopicConnection con, TopicSession pubSess,
            TopicSession subSess, TopicPublisher pub,
            String username) {
            this.connection = con;
            this.pubSession = pubSess;
            this.subSession = subSess;
            this.publisher = pub;
            this.userName = username;
            }
            /* Receive message from topic subscriber */
            public void onMessage(Message message) {
            try {
            System.out.println("getting Message....");
            ObjectMessage objectMessage = (ObjectMessage)message;
            // KmEvent event = (KmEvent)objectMessage.getObject();
            String str = (String)objectMessage.getObject();
            System.out.println(str);

            } catch(JMSException jmse){ jmse.printStackTrace(); }
            }
            /* Create and send message using topic publisher */
            protected void writeMessage(String text)throws JMSException {
            ObjectMessage message = pubSession.createObjectMessage();
            //KmEvent event = new KmEvent("hello World" + System.currentTimeMillis());
            message.setStringProperty("orgID", "123");
            message.setObject("hello");
            System.out.println("Writing Message from user = " + userName);
            publisher.publish(message);
            }
            /* Close the JMS connection */
            public void close() throws JMSException {
            connection.close();
            }
            /* Run the Chat client */
            public static void main(String [] args){
            try{
            if(args.length!=3)
            System.out.println("Topic or username missing");

            // args[0]=topicName; args[1]=username; args[2]=password
            Chat chat = new Chat(args[0],args[1],args[2]);

            // read from command line
            BufferedReader commandLine = new
            java.io.BufferedReader(new
            InputStreamReader(System.in));

            // loop until the word "exit" is typed
            while(true){
            Thread.sleep(5000);
            String s = "Hello World";// commandLine.readLine();
            if(s.equalsIgnoreCase("exit")){
            chat.close(); // close down connection
            System.exit(0);// exit program
            }else{
            chat.writeMessage(s);
            }
            }
            }catch(Exception e){ e.printStackTrace(); }
            }
            }