3 Replies Latest reply on Feb 24, 2004 11:50 PM by yxyang

    Question about *-service.xml and jms-ds.xml

      Hello,

      I am using 3.2.3 and runing in redhat9.0. IBMJVM 1.4.1.

      I try to send messge to a queue within a session bean method. Following is code:

      Context enc = (Context) iniCtx.lookup("java:comp/env");
      QueueConnectionFactory qcf =
      (QueueConnectionFactory) enc.lookup("jms/QueueConnectionFactory");
      qc = qcf.createQueueConnection();
      queueSession =
      qc.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue) enc.lookup("jms/Queue"); QueueSender queueSender = queueSession.createSender(queue);
      TextMessage jmsMessage = queueSession.createTextMessage(xmlString);
      queueSender.send(jmsMessage);

      In the jboss.xml fle, I tried two solutions to bind the resource.The first is using of
      < resource-name> and <resource-manager>. and the second is using jndi-name.


      My question is :

      (1) I assume that the first solution is to use the JCA managed connections defined in jms-ds.xml. And the second is use the connections provided by mbeans defined in *-service.xml . Is this assumption correct???????

      (2)When i use the first way (JCA resource-manager), it works fine. However,if i try the second way (use jndi-name) and set the jndi-name attribute value to java:/ConnectionFactory, or ConnectionFactory, or java:/UIL2ConnectionFactory,or UIL2ConnectionFactory, it has the following problems:

      Symptons: The session bean logged that the messages are sent to the queue successfully. But the receiver running in other JVM doesn't receive any message.

      (3)Is the transaction attribute of the session bean's method related to this problem????

      Notes: In above two testing cases, the codes are exactly the same, i only modified the configurations mentioned above.

      Why? Please help!

      thanks very much!


      yang

        • 1. Re: Question about *-service.xml and jms-ds.xml

          I deleted your other post.
          DO NOT CROSS POST - you just waste people's
          time answering the same question. Also you make it twice has hard
          for people to find the solution when they have the same problem.

          If you are not going to use the jca connection factory java:/JmsXA
          whose sessions get enlisted in the JTA transaction
          you must commit the jms session manually
          queueSession.commit()
          or not use a transacted session
          queueSession = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

          There is no such binding as java:/UIL2ConnectionFactory, unless you
          created it?

          Regards,
          Adrian

          • 2. Re: Question about *-service.xml and jms-ds.xml

            Thanks adrian

            >If you are not going to use the jca connection factory java:/JmsXA
            >whose sessions get enlisted in the JTA transaction
            >you must commit the jms session manually
            >queueSession.commit()
            >or not use a transacted session
            >queueSession = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

            >There is no such binding as java:/UIL2ConnectionFactory, unless you
            >created it?

            How to create it? in jms-ds.xml ? What does < jndi-name > mean?

            I assume that UIL2ConnectionFactory is the jndi-name of a connection factory which is bound into jboss jndi by MBeans defined in *-service.xml. Is this assumption correct?

            Would you mind answer the following question in the original post?

            (1) I assume that the first solution is to use the JCA managed connections defined in jms-ds.xml. And the second is use the connections provided by mbeans defined in *-service.xml . Is this assumption correct???????

            (2)In jboss.xml file,
            < resource-ref >
            < res-ref-name >jms/LocalQueueConnectionFactory< /res-ref-name >
            <!-- <resource-name>qcfibmt41</resource-name>-->
            < jndi-name >UIL2ConnectionFactory< /jndi-name >
            < /resource-ref >

            when i use < jndi-name >, i assume that UIL2ConnectionFactory is bound by the MBeans defined in *-service.xml.

            If i uncomment < resouce-name > and comment < jndi-name >, it works fine. I just want know what the < jndi-name > represents?

            Thanks very much!
            yang


            • 3. Re: Question about *-service.xml and jms-ds.xml

              thanks adrian

              I understand now and fix the problem following your instruction..


              regards

              yang