5 Replies Latest reply on Jan 5, 2002 2:30 AM by jikky

    Getting org.jboss.mq.SpyJMSException: Cannot start a the cli

    Swaminathan Newbie

      I am running the example of a Session Bean publishing a message provided on Jboss site. First I deploy the bean then I run HelloSubscriber25. Then I run my test prog which invokes hello("xyz") on the bean. The bean prints the message alright but then it throws the following exception

      java.net.SocketException: listen failed (code=10055)
      [Default] org.jboss.mq.SpyJMSException: Cannot start a the client IL service
      [Default] at org.jboss.mq.Connection.startILService(Connection.java:428)
      .
      .
      .

      No message is received by HelloSubscriber25.

      I tried publishing from an MDB as well. It gives me the
      exception.

      Version : 2.4.1 downloaded from the site.

      Please help
      Thanx

        • 1. Re: Getting org.jboss.mq.SpyJMSException: Cannot start a the
          Hiram Chirino Expert

          Seems like a system failure and not a JBossMQ failure. What JDK/OS are you running and are you running in an applet??

          Regards,
          Hiram

          • 2. Re: Getting org.jboss.mq.SpyJMSException: Cannot start a the
            Swaminathan Newbie

            Hello Hiram

            Ya you were right I think its a problem with my system. I tried it on a different pc and its started working, though now I get an Invalid Transaction Id.

            Thanx a lot.
            Regards
            Jikky

            • 3. Re: Getting org.jboss.mq.SpyJMSException: Cannot start a the
              Hiram Chirino Expert

              Need at least a stack trace. If you enable debug in the log4j.properties it should help find the problem too. Finnally, the source is available to help you track the problem down.

              • 4. Re: Getting org.jboss.mq.SpyJMSException: Cannot start a the
                jikky Newbie

                Hi Hiram

                Let me tell u what i am doing. I have a mdb which is listening to topic X. On receiving a message it publishes another mesage to another topic Y. Now when it tries to publish a message it throws the foloowing exception

                ****** Server Side Exception *********
                [OILServerILService] The OILClientIL Connection is set up
                [SpyConnectionConsumer] SpyConnectionConsumer:TOPIC.testTopic->addMessage(mes=TextMessage@Hello World no. 1)
                [StdServerSessionPool] getting a server session
                [StdServerSessionPool] using server session: org.jboss.jms.asf.StdServerSession@133bcb
                [SpyConnectionConsumer] SpyConnectionConsumer:TOPIC.testTopic Starting the ServerSession.
                [StdServerSession] starting invokes on server session
                [StdServerSession] running...
                [StdServerSession] XAResource 'org.jboss.mq.SpyXAResource@46b6db' enlisted.
                [JMSContainerInvoker] processing message: TextMessage@Hello World no. 1
                [Default] Start : Bean got messageTextMessage@Hello World no. 1
                [Default] Before Publishing message: Hello World no. jik
                [HelloMDB] ConnectionFactoryLoader.getObjectInstance, name = 'JmsXA'
                [Default] createPublisher : found topicFactory = org.jboss.jms.ra.JmsConnectionFactoryImpl@581e80
                [Default] createPublisher : found topicConnection = org.jboss.jms.ra.JmsSessionFactoryImpl@48f675
                [SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance()
                [JBossMQProvider] no provider url; connecting to local JNDI
                [JBossMQProvider] created context: javax.naming.InitialContext@6d32c4
                [ConnectionFactoryHelper] using connection factory: org.jboss.mq.SpyXAConnectionFactory@6d484
                [ConnectionFactoryHelper] using username/password: null/null
                [Connection] Connection Initializing
                [Connection] Getting the serverIL
                [Connection] Authenticating
                [Connection] Starting the clientIL service
                [Connection] Connection establishment successful
                [ConnectionFactoryHelper] created XATopicConnection: org.jboss.mq.SpyXAConnection@1fea8a
                [Default] FINE: created connection: org.jboss.mq.SpyXAConnection@1fea8a
                [Default] FINE: xaTopicSession: org.jboss.mq.SpyTopicSession@5f2d38
                [Default] FINE: topicSession: org.jboss.mq.SpyTopicSession@5f2d38
                [Default] FINE: transacted: true
                [Default] FINE: ack mode: 1
                [JmsXA] FINE: Setting LogWriter: org.jboss.logging.LogWriter@f9a32
                [JmsXA] Pool org.jboss.jms.ra.JmsManagedConnectionFactory-1 [0/0/10] gave out new object: org.jboss.jms.ra.JmsManagedConnection@11e831
                [JmsXA] FINE: ConnectionEvent listener added
                [JmsXA] Connection handle 'org.jboss.jms.ra.JmsSession@467991' issued by connection manager 'org.jboss.pool.connector.jboss.MinervaXACM@575c47' from mcf 'org.jboss.jms.ra.JmsManagedConnectionFactory@882cf118'
                [JmsXA] FINE: Closing session
                [JmsXA] FINE: Sending connection event: 1
                [JmsXA] Connection handle 'org.jboss.jms.ra.JmsSession@467991' closed from connection manager 'org.jboss.pool.connector.jboss.MinervaXACM@575c47' from mcf 'org.jboss.jms.ra.JmsManagedConnectionFactory@882cf118'
                [JmsXA] Pool org.jboss.jms.ra.JmsManagedConnectionFactory-1 [0/1/10] returned object org.jboss.jms.ra.JmsManagedConnection@11e831 to the pool.
                [Default] javax.jms.JMSException: Invalid transaction id.
                [Default] at org.jboss.mq.SpyXAResourceManager.addMessage(SpyXAResourceManager.java:76)
                [Default]
                [Default] at org.jboss.mq.SpySession.sendMessage(SpySession.java:396)
                [Default]
                [Default] at org.jboss.mq.SpyTopicPublisher.publish(SpyTopicPublisher.java:106)
                [Default]
                [Default] at org.jboss.mq.SpyTopicPublisher.publish(SpyTopicPublisher.java:69)
                [Default]
                [Default] at jbossMdb.HelloMDB.publish(HelloMDB.java:61)
                [Default]
                [Default] at jbossMdb.HelloMDB.onMessage(HelloMDB.java:112)
                [Default]
                [Default] at java.lang.reflect.Method.invoke(Native Method)
                [Default]
                [Default] at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:400)
                [Default]
                [Default] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:58)
                [Default]
                [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
                [Default]
                [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:247)
                [Default]
                [Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
                [Default]
                [Default] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
                [Default]
                [Default] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
                [Default]
                [Default] at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:281)
                [Default]
                [Default] at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:165)
                [Default]
                [Default] at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:644)
                [Default]
                [Default] at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:420)
                [Default]
                [Default] at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:295)
                [Default]
                [Default] at org.jboss.mq.SpySession.run(SpySession.java:216)
                [Default]
                [Default] at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:177)
                [Default]
                [Default] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:642)
                [Default]
                [Default] at java.lang.Thread.run(Unknown Source)
                [Default]
                [StdServerSessionPool] recycled server session: org.jboss.jms.asf.StdServerSession@133bcb
                [StdServerSession] done

                ****** End Server Exception *******

                Now my code looks like this

                ***** Code ****

                package jbossMdb;

                import java.util.*;
                import javax.naming.Context;
                import javax.naming.InitialContext;
                import javax.naming.NamingException;
                import javax.ejb.MessageDrivenBean;
                import javax.ejb.MessageDrivenContext;
                import javax.ejb.EJBException;
                import javax.jms.TopicConnectionFactory;
                import javax.jms.TopicConnection;
                import javax.jms.TopicSession;
                import javax.jms.TopicPublisher;
                import javax.jms.Topic;
                import javax.jms.TextMessage;
                import javax.jms.Session;
                import javax.jms.JMSException;

                import javax.jms.MessageListener;
                import javax.jms.Message;

                public class HelloMDB implements MessageDrivenBean, MessageListener
                {
                private MessageDrivenContext ctx = null;

                //private HelloWorkerHome workerHome = null;

                public HelloMDB() {}

                public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException {
                this.ctx = ctx;
                }

                public void ejbCreate()
                {
                //try
                //{
                // Context initCtx = new InitialContext();
                // workerHome = (HelloWorkerHome)initCtx.lookup("jBossSession.HelloWorker");
                //}
                //catch(Exception ex)
                //{
                // //throw new CreateException("Could not get worker: " + ex);
                // ex.printStackTrace();
                //}
                }

                public void ejbRemove() { ctx=null; }

                public void publish(String msg, TopicConnection topicConnection, Topic topic) throws JMSException
                {
                TopicPublisher topicPublisher = null;
                TopicSession topicSession = null;

                try
                {
                topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                topicPublisher = topicSession.createPublisher(topic);
                TextMessage message = topicSession.createTextMessage();
                message.setText(msg);
                topicPublisher.publish(topic, message);
                }
                finally
                {
                try
                {
                if ( topicPublisher!=null ) topicPublisher.close();
                if ( topicSession!=null ) topicSession.close();
                }
                catch (Exception e)
                {
                e.printStackTrace();
                }
                }
                }

                public void onMessage(Message message)
                {
                TopicConnection topicConnection = null;
                Topic topic = null;

                System.err.println("Start : Bean got message" + message.toString() );

                //try
                //{
                String msg = "Hello World no. jik";
                System.err.println("Before Publishing message: " + msg);

                try
                {
                //HelloWorker worker = workerHome.create();
                //
                //if (message instanceof TextMessage)
                //{
                // TextMessage m = (TextMessage)message;
                // worker.doWork(m.getText());
                //}
                //}//


                Context context = new InitialContext();
                TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup("java:comp/env/ConnectionFactory");

                System.err.println("createPublisher : found topicFactory = " + topicFactory);

                topicConnection = topicFactory.createTopicConnection();

                System.err.println("createPublisher : found topicConnection = " + topicConnection);

                topic = (Topic)context.lookup("java:comp/env/topic/revera.topic.imagingTopic");

                publish(msg, topicConnection, topic);
                System.err.println("After Publishing message: " + msg);
                }
                catch(Exception e)
                {
                e.printStackTrace();
                }
                finally
                {
                try
                {
                if ( topicConnection != null) topicConnection.close();
                }
                catch(Exception e)
                {
                e.printStackTrace();
                }
                }
                }
                }

                ****** End Code ****

                ****** Jboss.xml *****
                <?xml version="1.0" encoding="Cp1252"?>

                false
                <resource-managers>
                <resource-manager>
                <res-name>topicfactoryref</res-name>
                <res-jndi-name>java:/JmsXA</res-jndi-name>
                </resource-manager>
                <resource-manager>
                <res-name>topicref</res-name>
                <res-jndi-name>topic/testTopic</res-jndi-name>
                </resource-manager>
                </resource-managers>

                <enterprise-beans>
                <message-driven>
                <ejb-name>HelloMDB</ejb-name>
                <configuration-name>Standard Message Driven Bean</configuration-name>
                <destination-jndi-name>topic/testTopic</destination-jndi-name>

                <resource-ref>
                <res-ref-name>ConnectionFactory</res-ref-name>
                <resource-name>topicfactoryref</resource-name>
                </resource-ref>

                <resource-ref>
                <res-ref-name>topic/revera.topic.imagingTopic</res-ref-name>
                <resource-name>topicref</resource-name>
                </resource-ref>

                </message-driven>
                </enterprise-beans>

                ****** End Jboss.xml ******

                ****** ejb-jar.xml ******
                <?xml version="1.0"?>
                <!DOCTYPE ejb-jar>
                <ejb-jar>
                <enterprise-beans>
                <message-driven>
                <ejb-name>HelloMDB</ejb-name>
                <ejb-class>jbossMdb.HelloMDB</ejb-class>
                <message-selector></message-selector>
                <transaction-type>Container</transaction-type>
                <message-driven-destination>
                <destination-type>javax.jms.Topic</destination-type>
                <subscription-durability>NonDurable</subscription-durability>
                </message-driven-destination>

                <resource-ref>
                A Topic ConnectionFactory
                <res-ref-name>ConnectionFactory</res-ref-name>
                <res-type>javax.jms.TopicConnectionFactory</res-type>
                <res-auth>Container</res-auth>
                </resource-ref>
                <resource-ref>
                A Topic
                <res-ref-name>topic/revera.topic.imagingTopic</res-ref-name>
                <res-type>javax.jms.Topic</res-type>
                <res-auth>Container</res-auth>
                </resource-ref>
                </message-driven>
                </enterprise-beans>

                <assembly-descriptor>
                <container-transaction>

                <ejb-name>HelloMDB</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>NotSupported</trans-attribute>
                </container-transaction>
                </assembly-descriptor>
                </ejb-jar>
                ****** end ejb-jar.xml *****

                I have formatted my machine and tried this on a different machine as well. My version is 2.4.1.
                Note that line 61 is "topicPublisher.publish(topic, message);" in HelloMdb of my code.


                Please advice
                Thanx in advance
                Jikky



                • 5. Re: Getting org.jboss.mq.SpyJMSException: Cannot start a the
                  jikky Newbie

                  Hi

                  I got the problem. I was defining the ejb.xml file wrong.

                  Thanx
                  Jikky