1 2 Previous Next 15 Replies Latest reply on Feb 20, 2009 6:06 AM by ryandavid

    Integration with Oracle AQ via Sun Adapter

    ryandavid

      Hello to everybody,
      I have to integrate my JBoss 4.0.2 with OracleAQ.
      I cannot deploy a JBoss ESB on it because it requires a 4.0.5 at least and I cannot upgrade the server.

      So I decided to take the Sun Adapter solution described in the wiki

      http://www.jboss.org/community/docs/DOC-9035

      So I created an oracleaq-ds.xml like this

      <?xml version="1.0" encoding="UTF-8"?>
      <connection-factories>
      
      <mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.oracleaq:service=Queue,name=msg_queue">
       <attribute name="JNDIName">oracleaq/queue/msg_queue</attribute>
       <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='oracleaq.rar'</depends>
       <attribute name="Type">javax.jms.Queue</attribute>
       <attribute name="Properties">
       DestinationProperties=owner\=senaprod,name\=FROM_QUEUE
       </attribute>
      </mbean>
      
      
       <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
       <tx-connection-factory>
       <jndi-name>jdbc/OracleAQ</jndi-name>
       <rar-name>oracleaq.rar</rar-name>
       <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
       <config-property name="ConnectionFactoryProperties" type="java.lang.String">host=mydbms,user=scott,password=mypass,port=1521,sid=svil,driver=thin</config-property>
       <config-property name="username" type="java.lang.String">scott</config-property>
       <config-property name="password" type="java.lang.String">mypass</config-property>
       <max-pool-size>20</max-pool-size>
       </tx-connection-factory>
      
      </connection-factories>


      and deployed the oracleaq.rar as required.

      When I try to get a connection

      QueueConnectionFactory queueFactory = QueueConnectionFactory)context.lookup("java:jdbc/OracleAQ");
      
      QueueConnection queueConnection = queueFactory.createQueueConnection();
      


      I get this error

      javax.jms.JMSException: invalid arguments in call
       at com.sun.genericra.util.ExceptionUtils.newJMSException(ExceptionUtils.java:67)
       at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:80)
       at com.sun.genericra.outbound.ConnectionFactory.createQueueConnection(ConnectionFactory.java:115)
       at it.senato.testjms.FeederServlet.startJMSConnection(FeederServlet.java:69)
       at it.senato.testjms.FeederServlet.process(FeederServlet.java:116)
       at it.senato.testjms.FeederServlet.doGet(FeederServlet.java:95)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.resource.ResourceException: invalid arguments in call
       at com.sun.genericra.util.ExceptionUtils.newResourceException(ExceptionUtils.java:73)
       at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:130)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:508)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:207)
       at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:534)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:395)
       at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:297)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:447)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:874)
       at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:75)
       ... 25 more
      Caused by: oracle.jms.AQjmsException: invalid arguments in call
       at oracle.jms.AQjmsDBConnMgr.checkForSecurityException(AQjmsDBConnMgr.java:926)
       at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:605)
       at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:172)
       at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:163)
       at oracle.jms.AQjmsQueueConnectionFactory.createQueueConnection(AQjmsQueueConnectionFactory.java:229)
       at com.sun.genericra.outbound.ManagedQueueConnectionFactory.createConnection(ManagedQueueConnectionFactory.java:60)
       at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createPhysicalConnection(AbstractManagedConnectionFactory.java:141)
       at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:122)
       ... 33 more
      


      All the connection parameters are ok. I decompiled some AQ classes but I don't find nothing. Do you have some idea ?

        • 1. Re: Integration with Oracle AQ via Sun Adapter
          vickyk

           

          Caused by: javax.resource.ResourceException: invalid arguments in call

          Some ConnectionProperties seems to be missing/wrong in the configuration file, this is my guess right now ;)
          Are you using the same rar file that is attached at the following location or you have been trying to deploy some newer version of rar ?
          http://www.jboss.org/community/docs/DOC-9035


          • 2. Re: Integration with Oracle AQ via Sun Adapter
            ryandavid

            Yes, I am using the same rar file and the same xml file attached in that article.

            I have just included the Oracle libraries aqapi.jar, etc. in that rar (as described in the article).

            • 3. Re: Integration with Oracle AQ via Sun Adapter
              vickyk

               

              Caused by: oracle.jms.AQjmsException: invalid arguments in call
               at oracle.jms.AQjmsDBConnMgr.checkForSecurityException(AQjmsDBConnMgr.java:926)
               at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:605)
               at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:172)
               at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:163)
               at oracle.jms.AQjmsQueueConnectionFactory.createQueueConnection(AQjmsQueueConnectionFactory.java:22
              9)

              Some thing seems to be wrong over here, I think enabling the log info at the oracle related classes will help.
              I have not tried it before but you can give it a try.


              • 4. Re: Integration with Oracle AQ via Sun Adapter
                ryandavid

                 

                Caused by: oracle.jms.AQjmsException: argomenti non validi nella chiamata
                 at oracle.jms.AQjmsDBConnMgr.checkForSecurityException(AQjmsDBConnMgr.java:321)
                 at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:541)
                 at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:69)
                 at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:163)
                 at oracle.jms.AQjmsQueueConnectionFactory.createQueueConnection(AQjmsQueueConnectionFactory.java:108)
                 at com.sun.genericra.outbound.ManagedQueueConnectionFactory.createConnection(ManagedQueueConnectionFactory.java:60)
                 at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createPhysicalConnection(AbstractManagedConnectionFactory.java:141)
                 at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:122)
                 ... 33 more
                


                I debugged the aqapi.jar class file and I discovered that it is called the method createConnection (the first method that doesn't take user/password parameters) of AQjmsQueueConnectionFactory class.

                So the problem should be in classes of sun adapter.

                • 5. Re: Integration with Oracle AQ via Sun Adapter
                  vickyk

                   

                  "ryandavid" wrote:

                  I debugged the aqapi.jar class file and I discovered that it is called the method createConnection (the first method that doesn't take user/password parameters) of AQjmsQueueConnectionFactory class.

                  So the problem should be in classes of sun adapter.


                  The jca ConnectionManager should call createManagedConnection(...) on MCF(ManagedConnectionFactory) with Subject and CRI as parameter
                  http://72.5.124.55/j2ee/apidocs-1_5-fr/javax/resource/spi/ManagedConnectionFactory.html#createManagedConnection(javax.security.auth.Subject,%20javax.resource.spi.ConnectionRequestInfo)

                  The MCF's createManagedConnection(..) should retrieve the connection properties ie UserName/Password from the CRI(ConnectionRequestInfo) object.

                  I hope this helps you to dig the details further ;)


                  • 6. Re: Integration with Oracle AQ via Sun Adapter
                    ryandavid

                    Indeed I have arrived to method createManagedConection as you wrote.

                    So, the username/password that I configured into the oracleaq-ds.xml file it should be found in ConnectionRequestInfo object ?

                    • 7. Re: Integration with Oracle AQ via Sun Adapter
                      ryandavid

                      Strangely if put the credentials into the createConnection

                      QueueConnection queueConnection = queueFactory.createQueueConnection("scott","mypass");


                      the conect is made.
                      In some way the credentials aren't read from the XML file.

                      Anayway I get then the following exception

                      javax.jms.JMSException: Conncetion.setExceptionListener() cannot be called on non-ACC clients
                       at com.sun.genericra.outbound.ConnectionHandle.setExceptionListener(ConnectionHandle.java:166)
                       at it.senato.testjms.FeederServlet.startJMSConnection(FeederServlet.java:74)
                       at it.senato.testjms.FeederServlet.process(FeederServlet.java:116)
                       at it.senato.testjms.FeederServlet.doGet(FeederServlet.java:95)
                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
                       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                       at java.lang.Thread.run(Thread.java:595)
                      



                      • 8. Re: Integration with Oracle AQ via Sun Adapter
                        ryandavid

                        Ok, the last exception was due to the ExceptionListener that I was trying to set.
                        So I removed that from my client code. Now I get this exception when I create a QueueSession

                        java.lang.NoSuchMethodError: oracle.jdbc.internal.OracleConnection.getDbCsId()S
                         at oracle.jms.AQjmsSession.setDBRatio(AQjmsSession.java:474)
                         at oracle.jms.AQjmsSession.<init>(AQjmsSession.java:343)
                         at oracle.jms.AQjmsConnection.createQueueSession(AQjmsConnection.java:653)
                         at com.sun.genericra.outbound.ManagedConnection.createLocalSession(ManagedConnection.java:180)
                         at com.sun.genericra.outbound.ManagedConnection.getPhysicalJMSSession(ManagedConnection.java:117)
                         at com.sun.genericra.outbound.ConnectionHandle.createSession(ConnectionHandle.java:223)
                         at com.sun.genericra.outbound.ConnectionHandle.createQueueSession(ConnectionHandle.java:246)
                         at it.senato.testjms.FeederServlet.sendMessage(FeederServlet.java:157)
                         at it.senato.testjms.FeederServlet.process(FeederServlet.java:125)
                         at it.senato.testjms.FeederServlet.doGet(FeederServlet.java:96)
                         at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
                         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                         at java.lang.Thread.run(Thread.java:595)
                        

                        Can be a problem of jars version ?

                        • 9. Re: Integration with Oracle AQ via Sun Adapter
                          ryandavid

                          I am downloaded and used libraries of OC4J Version 9.0.4 and I can successfully send a message in the queue.

                          I think that OC4J 10 libraries doesn't wotk with JBoss 4.0.2

                          Anyway the other strange behaviour is that I cannot put the credentials into the oracleaq-ds.xml

                          • 10. Re: Integration with Oracle AQ via Sun Adapter
                            vickyk

                             

                            "ryandavid" wrote:
                            Indeed I have arrived to method createManagedConection as you wrote.

                            So, the username/password that I configured into the oracleaq-ds.xml file it should be found in ConnectionRequestInfo object ?

                            Ideally yes, have a look at the CRI implementation of jms ra for Jboss here
                            http://anonsvn.jboss.org/repos/jbossas/branches/JBPAPP_4_2/connector/src/main/org/jboss/resource/adapter/jms/JmsConnectionRequestInfo.java

                            • 11. Re: Integration with Oracle AQ via Sun Adapter
                              vickyk

                               

                              "ryandavid" wrote:

                              Anyway the other strange behaviour is that I cannot put the credentials into the oracleaq-ds.xml

                              What do you mean by this, I am unable to understand?
                              It is already placed in -ds.xml
                              <config-property name="username" type="java.lang.String">SCOTT</config-property>
                              <config-property name="password" type="java.lang.String">2brpq8n3</config-property>


                              • 12. Re: Integration with Oracle AQ via Sun Adapter
                                ryandavid

                                I mean that I have filled the username and password in config-property element as you but I saw that the createConnection doesn't receive them.

                                So it works only if I use

                                QueueConnection queueConnection = queueFactory.createQueueConnection("scott","mypass");


                                In addition I am trying to use a MDB. Do you have an example of deployment descriptors for it ?

                                • 13. Re: Integration with Oracle AQ via Sun Adapter
                                  ryandavid

                                  I fixed the problem of the credentials.

                                  In the -ds.xml the ConnectionFactoryProperties should be configured as

                                  <config-property name="ConnectionFactoryProperties" type="java.lang.String">jdbc_connect_string=jdbc:oracle:thin:scott/mypass@muhost:1521:svil,host=myhost,user=scott,password=mypass,port=1521,sid=svil,driver=thin</config-property>


                                  I think that wiki page of Sun Adapter should be updated

                                  • 14. Re: Integration with Oracle AQ via Sun Adapter
                                    vickyk

                                     

                                    "ryandavid" wrote:

                                    I think that wiki page of Sun Adapter should be updated


                                    Yes, please update the wiki after you have tested the stuff thoroughly.


                                    1 2 Previous Next