5 Replies Latest reply on Jan 4, 2007 8:34 AM by norman.richards

    Jboss messaging supported?

    liudan2005

      I'm using JBoss messaging at moment. I can send a message from a standalone client. When I try to send a message from my ejb, I keep getting NullPointerException.

      Here is how I defined the component

       <component name="paymentQueueSender" class="org.jboss.seam.jms.ManagedQueueSender">
       <property name="queueJndiName">queue/testQueue</property>
       </component>
      


      Is there any guidelines of how u can use jboss messaging in Seam?

        • 1. Re: Jboss messaging supported?

          Please check the documentation for exact usage. It does work. Can you show the code where you are injecting paymentQueueSender? Where exactly are you getting a null pointer? Is the paymentQueueSender itself null?

          • 2. Re: Jboss messaging supported?
            liudan2005

            I simply followed seam doc http://docs.jboss.com/seam/1.1GA/reference/en/html/jms.html#d0e5121

            and I haven't added any thing new. The doc seem to be not updated. Here is my code:

            @In(create=true)
            private QueueSender paymentQueueSender;
            @In(create=true)
            private QueueSession queueSession;
            
            public void publish(Payment payment) {
             try
             {
             paymentQueueSender.send( queueSession.createObjectMessage(payment) );
             }
             catch (Exception ex)
             {
             throw new RuntimeException(ex);
             }
            }
            


            Here is the component defined in my components.xml
            <component name="paymentQueueSender" class="org.jboss.seam.jms.ManagedQueueSender">
             <property name="queueJndiName">queue/testQueue</property>
             </component>
            


            In the doc, it says you need to define queueConnection.queueConnectionFactoryJndiName and topicConnection.topicConnectionFactoryJndiName if you use anything other than JbossMQ. Can you give an example of how to use it with JBoss Messaging?

            • 3. Re: Jboss messaging supported?

              I don't have jboss messaging installed, but it should be as simple as setting the jndi name for your connection factory:

              <jms:queue-connection queue-connection-factory-jndi-name="/ConnectionFactory" />
              


              (I think that's the correct JNDI name for jboss messaging - you'll have to check for yourself on that)

              • 4. Re: Jboss messaging supported?
                liudan2005

                It says "jms:queue-connection" is not a valid tag in components.xml when I deploy it. here is my xml definition:


                <components xmlns="http://jboss.com/products/seam/components"
                 xmlns:core="http://jboss.com/products/seam/core"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation=
                 "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd
                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd">
                
                


                What's your xml like?

                • 5. Re: Jboss messaging supported?

                  You need to add the jms namespace declaration or use the older style component/property generic-XML equivalent. Please see the recent Seam examples to see the new XML structure in action.