6 Replies Latest reply on Oct 15, 2008 9:29 AM by Timur Gasrataliev

    helloworld_action quickstart with OracleAQ

    Timur Gasrataliev Newbie

      Hi, i`m trying to launch helloworld_action quickstart on jboss esb server with OracleAQ.

      I followed steps in readme.txt, but right after deployment to server i cought NamingException

      Here is a part of jboss-esb.xml file i used:

      <jms-provider name="JBossMQ"
       connection-factory="QueueConnectionFactory">
       <property name="java.naming.factory.initial"
       value="org.jboss.soa.esb.oracle.aq.AQInitialContextFactory"/>
       <property name="java.naming.oracle.aq.user"
       value="JBOSS_ESB_SERVER"/>
       <property name="java.naming.oracle.aq.password"
       value="JBOSS_ESB_SERVER"/>
       <property name="java.naming.oracle.aq.server"
       value="192.168.100.40"/>
       <property name="java.naming.oracle.aq.instance" value="db"/>
       <property name="java.naming.oracle.aq.schema"
       value="JBOSS_ESB_SERVER"/>
       <property name="java.naming.oracle.aq.port" value="1521"/>
       <property name="java.naming.oracle.aq.driver" value="thin"/>
      
       <jms-bus busid="quickstartGwChannel">
       <jms-message-filter
       dest-type="QUEUE"
       dest-name="ACTION_REQUEST"
       />
       </jms-bus>
      
       <jms-bus busid="quickstartEsbChannel">
       <jms-message-filter
       dest-type="QUEUE"
       dest-name="B"
       />
       </jms-bus>
      
      </jms-provider>


      and this is log:

      11:06:05,470 INFO [JBoss4ESBDeployer] create esb service, Quickstart_helloworld_action.esb
      11:06:05,705 INFO [JDBCDataStore] Generated token 'authToken:C5645F90-9396-11DD-A81B-F00D0A606087' for user: 'jbossesb/JBoss ESB User'
      11:06:07,455 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
      11:06:07,502 INFO [JmsConnectionPool] Received NamingException, refreshing context.
      11:06:08,517 WARN [MessageAwareListener] Error processing courier, backing off for 1000 milliseconds
      11:06:09,517 INFO [JmsConnectionPool] Received NamingException, refreshing context.
      11:06:10,517 WARN [MessageAwareListener] Error processing courier, backing off for 2000 milliseconds
      11:06:12,517 INFO [JmsConnectionPool] Received NamingException, refreshing context.
      11:06:13,517 WARN [MessageAwareListener] Error processing courier, backing off for 4000 milliseconds


      Can anyone help me to solve this problem?

        • 1. Re: helloworld_action quickstart with OracleAQ
          Timur Gasrataliev Newbie

          I tried to add jndi-context-factory attribute to jms-provider and NamingException gone

          not jms-provider looks like this:

          <jms-provider name="JBossMQ"
           connection-factory="QueueConnectionFactory"
           jndi-context-factory="org.jboss.soa.esb.oracle.aq.AQInitialContextFactory">
          
          ...
          ...
          
          </jms-provider>
          


          Quickstart_helloworld_action service started successfully. Then i want to enqueue message to ACTION_REQUEST queue. This is PL/SQL code i executed:

          DECLARE
           enqueue_options DBMS_AQ.enqueue_options_t;
           message_properties DBMS_AQ.message_properties_t;
           message_handle RAW(16);
           MESSAGE SYS.aq$_jms_message;
          BEGIN
           MESSAGE := SYS.aq$_jms_message.construct(0);
           MESSAGE.set_text('Hello');
           MESSAGE.set_userid('Userid_if_reqd');
           MESSAGE.set_string_property('JMS_OracleDeliveryMode', 2);
           DBMS_AQ.enqueue(queue_name => 'ACTION_REQUEST', enqueue_options => enqueue_options, message_properties => message_properties, payload => MESSAGE, msgid => message_handle);
           COMMIT;
          END;
          


          After that i cought this error:

          2008-10-06 11:44:05,161 DEBUG [org.jboss.soa.esb.filter.FilterManager] FilterManager calling org.jboss.internal.soa.esb.message.filter.MetaDataFilter@93230d.onOutput
          2008-10-06 11:44:05,161 DEBUG [org.jboss.soa.esb.filter.FilterManager] FilterManager calling org.jboss.internal.soa.esb.message.filter.GatewayFilter@1e2622b.onOutput
          2008-10-06 11:44:05,239 DEBUG [org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool] Number of Sessions in the pool with acknowledgeMode: 1 is now 2
          2008-10-06 11:44:05,270 DEBUG [org.jboss.internal.soa.esb.couriers.JmsCourier] JMSCourier deliveryMode: 2, peristent:true
          2008-10-06 11:44:05,348 DEBUG [org.jboss.soa.esb.notification.jms.DefaultJMSPropertiesSetter] Setting outgoing JMSCorreletionID to : a60e075f-3914-4de8-b51d-4809f4790051
          2008-10-06 11:44:05,348 DEBUG [org.jboss.soa.esb.notification.jms.DefaultJMSPropertiesSetter] Setting outgoing JMSProperty, key : JMSXGroupSeq, value : 0
          2008-10-06 11:44:05,348 DEBUG [org.jboss.soa.esb.notification.jms.DefaultJMSPropertiesSetter] Setting outgoing JMSProperty, key : JMS_OracleDelay, value : 0
          2008-10-06 11:44:05,645 DEBUG [org.jboss.internal.soa.esb.couriers.JmsCourier] JMS error. Attempting JMS reconnect.
          oracle.jms.AQjmsException: JMS-120: Dequeue failed
           at oracle.jms.AQjmsError.throwEx(AQjmsError.java:311)
           at oracle.jms.AQjmsConsumer.dequeue(AQjmsConsumer.java:2244)
           at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:1021)
           at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:951)
           at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:929)
           at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:781)
           at org.jboss.internal.soa.esb.couriers.JmsCourier.pickupPayload(JmsCourier.java:414)
           at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:386)
           at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:240)
           at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:216)
           at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEventAndProcess(MessageAwareListener.java:280)
           at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(MessageAwareListener.java:248)
           at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
           at java.lang.Thread.run(Thread.java:619)
          
          [Linked-exception]
          java.lang.NullPointerException
           at java.util.Hashtable.put(Hashtable.java:399)
           at oracle.jms.AQjmsMessage.convertPropertyListToHashtable(AQjmsMessage.java:2382)
           at oracle.jms.AQjmsConsumer.dequeue(AQjmsConsumer.java:2153)
           at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:1021)
           at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:951)
           at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:929)
           at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:781)
           at org.jboss.internal.soa.esb.couriers.JmsCourier.pickupPayload(JmsCourier.java:414)
           at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:386)
           at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:240)
           at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:216)
           at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEventAndProcess(MessageAwareListener.java:280)
           at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(MessageAwareListener.java:248)
           at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
           at java.lang.Thread.run(Thread.java:619)
          


          • 2. Re: helloworld_action quickstart with OracleAQ
            Kevin Conner Master

            It looks like there may be a problem with the Oracle driver, at least that is the NPE that is being raised. I don't have OracleAQ handy, unfortunately, so I am not sure why this is happening.

            Which version are you using?

            • 3. Re: helloworld_action quickstart with OracleAQ
              Timur Gasrataliev Newbie

              I tried 3 different Oracle JDBC Driver versions:

              with "11.1.0.6.0-Production+" and "10.2.0.3.0" I got JMS-120: Dequeue failed and NPE

              with "10.2.0.1.0" NPE does not occur, but there is new problem:

              07:40:32,057 INFO [ServiceInvoker] Unresponsive EPR: JMSEpr [ PortReference < <wsa:Address jms://localhost:1099/B/>, ..... ]
              07:40:38,385 INFO [ServiceInvoker] Delivering message [...] to RDLVRQ.
              


              Database version: 10.2.0.3.0

              • 4. Re: helloworld_action quickstart with OracleAQ
                Timur Gasrataliev Newbie

                I found that there might be an error in aqapi13.jar
                I tried to write standalone java app that can enqueue and dequeue messages using aqapi13.jar and have some interesting results

                1. I enqueued message 'Hello World' into ACTION_REQUEST queue. Then I looked in QueueTable ACTION_REQUEST and saw my message there, but there were no 'hello world' string within USER_DATA column (TEXT_LEN field was set to 11, but text was empty)/
                When I tried to dequeue this message using my program i received JMS-120 exception with linked NPE (similar to one i've posted before)

                2. I enqueued message 'Hello World' into ACTION_REQUES using PL/SQL block. Then I found it in the queue table with 'Hello World' text inside. When i dequeued this message using my java app without any exceptions, but instead of 'Hello World' text received message contained '???'

                Here is the source of standalone java app i used:

                import junit.framework.TestCase;
                import javax.jms.Queue;
                import javax.jms.QueueConnection;
                import javax.jms.QueueConnectionFactory;
                import javax.jms.Session;
                import javax.jms.MessageProducer;
                import javax.jms.TextMessage;
                import javax.jms.MessageConsumer;
                import oracle.jms.AQjmsFactory;
                import oracle.jms.AQjmsSession;
                import javax.sql.DataSource;
                import org.jboss.soa.esb.oracle.aq.*;
                
                public class AqTest extends TestCase {
                
                 public void testEnqueue() throws Exception {
                 QueueConnectionFactory queueFactory;
                 QueueConnection queueConnection = null;
                 AQjmsSession session = null;
                 DataSource ds = null;
                 ds = AQUtil.getSQLDataSource("192.168.100.40", "db", 1521,
                 "thin", "JBOSS_ESB_SERVER", "JBOSS_ESB_SERVER");
                
                 queueFactory = AQjmsFactory.getQueueConnectionFactory(ds);
                 queueConnection = queueFactory.createQueueConnection();
                 session = (AQjmsSession) queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                 Queue queue = session.getQueue("JBOSS_ESB_SERVER", "ACTION_REQUEST");
                
                 MessageProducer prod = session.createSender(queue);
                 TextMessage msg = session.createTextMessage("Hello world");
                 msg.setText("Hello world!!!");
                 prod.send(msg);
                
                 }
                
                 public void testDequeue() throws Exception {
                 QueueConnectionFactory queueFactory;
                 QueueConnection queueConnection = null;
                 AQjmsSession session = null;
                 DataSource ds = null;
                 ds = AQUtil.getSQLDataSource("192.168.100.40", "db", 1521,
                 "thin", "JBOSS_ESB_SERVER", "JBOSS_ESB_SERVER");
                
                 queueFactory = AQjmsFactory.getQueueConnectionFactory(ds);
                 queueConnection = queueFactory.createQueueConnection();
                
                 queueConnection.start();
                
                 session = (AQjmsSession) queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                 Queue queue = session.getQueue("JBOSS_ESB_SERVER", "ACTION_REQUEST");
                
                 MessageConsumer cons = session.createReceiver(queue);
                 TextMessage msg = (TextMessage) cons.receive(1000);
                
                 if (msg != null) {
                 String s = msg.getText();
                 if(s == null)
                 System.out.println("S is null");
                 else
                 System.out.println(s);
                 }
                 else
                 System.out.println("Nothing...");
                
                 }
                }
                


                And here is PL/SQL block i used:
                DECLARE
                 enqueue_options DBMS_AQ.enqueue_options_t;
                 message_properties DBMS_AQ.message_properties_t;
                 message_handle RAW(16);
                 MESSAGE SYS.aq$_jms_message;
                BEGIN
                 MESSAGE := SYS.aq$_jms_message.construct(0);
                 MESSAGE.set_text('Hello World');
                 DBMS_AQ.enqueue(queue_name => 'jboss_esb_server.ACTION_REQUEST', enqueue_options => enqueue_options, message_properties => message_properties, payload => MESSAGE, msgid => message_handle);
                 COMMIT;
                END;


                Any help with this will be appreciated

                • 5. Re: helloworld_action quickstart with OracleAQ
                  Tschungel Buch Newbie

                  Hi Timur

                  Did you grant all of the following packages to your oracle user?
                  GRANT EXECUTE ON DBMS_AQADM TO ;
                  GRANT EXECUTE ON DBMS_AQ TO ;
                  GRANT EXECUTE ON DBMS_LOB TO ;
                  GRANT EXECUTE ON DBMS_JMS_PLSQL TO ;

                  I have the following versions:
                  Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
                  aqapi-13.jar size 1'152'771
                  I do not use an oracle client on the system where jboss is running.


                  Character Sets
                  Character size: 4 byte(s)
                  CharSetID: 873
                  NCharSetID: 2000
                  Unicode Support: True
                  NLS_LANG: AMERICAN_AMERICA.AL32UTF8
                  NLS_NCHAR_CHARACTERSET: AL16UTF16
                  NLS_CHARACTERSET: AL32UTF8


                  When looking throu your code I actually miss the service part on what to do with the message. Something like:

                   <service category="HelloWorld_ActionESB"
                   name="SimpleListener"
                   description="Hello World" >
                   <listeners>
                   <jms-listener name="JMS-Gateway"
                   busidref="quickstartGwChannel"
                   maxThreads="1"
                   is-gateway="true"
                   />
                  
                   <jms-listener name="JMS-ESBListener"
                   busidref="quickstartEsbChannel"
                   maxThreads="1"
                   />
                  
                   </listeners>
                   <actions>
                   <action name="displayAction"
                   class="org.jboss.soa.esb.oracle.aq.MyJMSListenerAction"
                   process="displayMessage">
                   <property name="exceptionMethod" value="exceptionHandler"/>
                   </action>
                   <action name="playAction"
                   class="org.jboss.soa.esb.oracle.aq.MyJMSListenerAction"
                   process="playWithMessage">
                  
                   <property name="exceptionMethod" value="exceptionHandler"/>
                   </action>
                  
                   <action name="notificationAction"
                   class="org.jboss.soa.esb.actions.Notifier">
                   <property name="okMethod" value="notifyOK" />
                   <property name="notification-details">
                   <NotificationList type="OK">
                   <target class="NotifyConsole" />
                   <target class="NotifyQueues">
                   <messageProp name="quickstart" value="hello_world_action" />
                   <queue jndiName="HELLO_WORLD_ACTION" connection-factory="QueueConnectionFactory">
                   <property name="java.naming.factory.initial" value="org.jboss.soa.esb.oracle.aq.AQInitialContextFactory"/>
                   <property name="java.naming.oracle.aq.user" value="user_name"/>
                   <property name="java.naming.oracle.aq.password" value="pass-word"/>
                   <property name="java.naming.oracle.aq.server" value="server.int.server.com"/>
                   <property name="java.naming.oracle.aq.instance" value="instance"/>
                   <property name="java.naming.oracle.aq.schema" value="schema"/>
                   <property name="java.naming.oracle.aq.port" value="1521"/>
                   <property name="java.naming.oracle.aq.driver" value="thin"/>
                   </queue>
                   </target>
                   </NotificationList>
                   </property>
                   </action>
                   </actions>
                   </service>
                  


                  Hope this helps
                  Tschungelbuch

                  • 6. Re: helloworld_action quickstart with OracleAQ
                    Timur Gasrataliev Newbie

                    Hi, tschungelbuch. Thanks for your answer

                    I`ve granted all privileges to my userÑŽ
                    I`ve patched Oracle Databgase to version 10.2.0.4.0 and used jdbc driver and aqapi13.jar that came from this patch/

                    But my program still does not work