5 Replies Latest reply on May 17, 2006 10:44 AM by 503952

    Oracle DB XE Advanced Queuing

    503952
      Hello,

      According to licensing document, Advanced Queuing is part of Oracle DB XE 10.2. My task is to access XE's AQ via AQxmlServlet, delpoyed on Tomcat WebServer.

      We can find: aqxml.jar, aqapi.jar in ORACLE_HOME\RDBMS\jlib\. So AQxmlServlet is shipped with XE. According rthome's post: Does Oracle Express support Java servlets? it is even tested and supported. So it should be no problem to deploy and use AQ servlet. BUT... I am not able to do it.

      I am using:
      XE DB 10.2
      JDeveloper 10.1.2
      JDK 1.4.2_06 shipped with JDeveloper in JDEV_HOME\jdk
      JDBC Drivers 10.2.0.1.0 shipped with XE DB in ORACLE_HOME\jdbc\lib\

      I have tryed these Apache Tomcat versions:
      Apache Tomcat 5.5.17 - Servlet 2.4 and JSP 2.0 specifications
      Jakarta Tomcat 5.0.28 - Servlet 2.4 and JSP 2.0 specifications
      Jakarta Tomcat 4.1.31 - Servlet 2.3 and JSP 1.2 specifications
      Jakarta Tomcat 3.3.2 - Servlet 2.2 and JSP 1.1 specifications


      That is what I do:

      1. I extend oracle.AQ.xml.AQxmlServlet servlet. Java code:

      import java.io.*;
      import javax.servlet.*;
      import javax.servlet.http.*;
      import oracle.AQ.*;
      import oracle.AQ.xml.*;
      import oracle.jdbc.pool.*;

      public class AQXmlServlet22 extends oracle.AQ.xml.AQxmlServlet
      {
      private static final String CONTENT_TYPE = "text/html; charset=windows-1257";

      public AQxmlDataSource createAQDataSource() throws AQxmlException {
      AQxmlDataSource db_drv = null;

      String sid = "xe";
      String port = "1521";
      String host = "localhost";
      String user = "mttools";
      String psw = "xxx";

      System.err.println("AQXmlServlet - setting db driver using");
      System.err.println("sid:" + sid + " port:" + port + " host:" + host );

      System.err.println("AQXmlServlet22 - setting db driver");
      System.err.print("DataSource using sid:host:port "+ sid + ":" + host + ":" + port);

      db_drv = new AQxmlDataSource(user, psw, sid, host, port);

      System.err.print("sid: "+ db_drv.getSid() );
      System.err.print(" host: "+ db_drv.getHost() );
      System.err.print(" port: "+ db_drv.getPort() );
      System.err.print(" cachesize: "+ db_drv.getCacheSize() );
      System.err.println(" cachescheme: "+ db_drv.getCacheScheme() );

      return db_drv;
      }

      public void init(ServletConfig config) throws ServletException {
      try {
      super.init(config);

      AQxmlDataSource axds = this.createAQDataSource();
      setAQDataSource(axds);

      setManualInvalidation(false);
      setSessionMaxInactiveTime(30);

      System.err.println("init done.");
      }
      catch (AQxmlException aq_ex) {
      System.out.println("AQ exception: " + aq_ex);
      aq_ex.printStackTrace();
      aq_ex.getNextException().printStackTrace();
      }
      catch ( Exception ex ) {
      System.err.println("Exception: " + ex);
      ex.printStackTrace();
      }
      }
      }

      I add these libraries to project properties:
      \RDBMS\jlib\aqapi.jar
      \RDBMS\jlib\aqxml.jar
      \RDBMS\jlib\servlet.jar
      \RDBMS\jlib\jmscommon.jar
      \RDBMS\jlib\xdb.jar
      \jlib\orai18n.jar
      \jdbc\lib\ojdbc14.jar

      I create WAR deployment profile and specify that all libraries except servlet.jar (Tomcat has its own servlet.jar or servlet-api.jar in TOMCAT_HOME\common\lib) would be contributed to WEB-INF/lib.

      I DON'T load ADF/BC4J and other libraries from JDeveloper, because JDeveloper has older JDBC drivers than provided in XE. Maybe that is a problem.

      I deploy WAR file to Tomcat WebServet. I try to invoke AQ Servlet:
      http://localhost:8081/XeAqXmlServletApp/AQXmlServlet22. I get:
      Sample AQ Servlet
      AQxmlServlet is working! 05/09/2006 09:59:08

      2. I create ORACLE_HOME/rdbms/demo/aqxmlREADME.txt example's queues on my XE DB

      3. When I try to POST first (aqxml01.xml) request using AqHttpRq helper I get exception (in Tomcat logs):

      StandardWrapperValve[AQXmlServlet22]: Servlet.service() for servlet AQXmlServlet22 threw exception
      java.lang.NullPointerException
      at oracle.AQ.xml.AQxmlServlet.doPost(AQxmlServlet.java:246)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      at java.lang.Thread.run(Thread.java:534)
      ------------------------------------------------------------------------------------------------------------------------
      WHAT IS WRONG?
      a) Problems with JDBC OCI?
      b) Servlet specification (Tomcat 5.x, 4.x supports 2.4, 2.3 servlet specification, according to ORACLE_HOME/rdbms/demo/aqxmlREADME.txt I need to use 2.2 servlet specification if I am deplying to Tomcat)?
      c) Deployed Libraries shipped with XE?
      d) Not installed ADF from JDeveloper?
      e) ...

      PLEASE HELP
        • 1. Re: Oracle DB XE Advanced Queuing
          503952
          I have installed Oracle Database 10g Standart Edition (10.2) on my mashine. I have compiled my AQ servlet using AQ jars that are shipped with SE DB. I have deployed AQ servlet to Jakarta-Tomcat-3.3.2 web server and the same exception occured!

          So I assume there is no problem with DB tier.

          There is no problem with JDBC OCI connection. When I invoke my servlet I get such log:

          AQXmlServlet - setting db driver using
          sid:xe port:1521 host:localhost
          AQXmlServlet22 - setting db driver
          DataSource using sid:host:port xe:localhost:1521sid: xe host: localhost port: 1521 cachesize: 50 cachescheme: 1
          init done

          Problems are somewhere else. Please, any help is required. Thanks in advance.
          • 2. Re: Oracle DB XE Advanced Queuing
            503952
            I have a feeling, that some libraries are not compatible or missing.

            Does anyone know if I need to do this (Load BC4J Runtime Libraries to Apache Tomcat)?:

            http://download-west.oracle.com/otn_hosted_doc/jdeveloper/904preview/packaging_deploying/dep_p_gwebappstomcat.html
            • 3. Re: Oracle DB XE Advanced Queuing
              503952
              I have added some code in extended AQxmlServlet to output some debug and tracing info into a log file. Here is the content of the log file:

              http-8085-Processor5 AQxmlDataSource:constructor: u/p/s/h/p - entry
              http-8085-Processor5 AQxmlDataSource:constructor: exit
              http-8085-Processor5 AQxmlServlet.doGet: entry
              http-8085-Processor5 AQxmlServlet.doGet: req_uri /XeAqXmlServletApp/AQXmlServlet22
              http-8085-Processor5 AQxmlServlet.doGet: sid: orcl host: localhost port: 1521 cachesize: 50
              http-8085-Processor5 AQxmlServlet.doGet: dbdrv valid
              http-8085-Processor5 AQxmlDataSource.getDBConnectionFromPool: user: null
              http-8085-Processor5 AQxmlDataSource.getDBConnectionFromPool: url: jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(PORT=1521)(HOST=localhost))(CONNECT_DATA=(SID=orcl)))
              http-8085-Processor5 AQxmlDataSource.getDBConnectionFromPool: Active Size: 0
              http-8085-Processor5 AQxmlDataSource.getDBConnectionFromPool: Cache Size: 1
              http-8085-Processor5 AQxmlServlet.doGet: db_conn valid
              http-8085-Processor4 content-type: text/xml
              http-8085-Processor4 AQxmlServlet: before AQxmlProcessor
              http-8085-Processor4 AQxmlServlet.getAQProcessor: entry
              http-8085-Processor4 AQxmlServlet: getting db driver
              http-8085-Processor4 AQxmlServContext:constructor-3: entry
              http-8085-Processor4 AQxmlIdapConverter.constructor: Entry
              http-8085-Processor4 AQxmlServContext.registerConverter: entry-namespace: http://ns.oracle.com/AQ/schemas/envelope
              http-8085-Processor4 AQxmlServContext.registerConverter: exit
              http-8085-Processor4 AQxmlSoapConverter.constructor: Entry
              http-8085-Processor4 AQxmlServContext.registerConverter: entry-namespace: http://schemas.xmlsoap.org/soap/envelope/
              http-8085-Processor4 AQxmlServContext.registerConverter: exit
              http-8085-Processor4 AQxmlServContext:constructor-3: exit
              http-8085-Processor4 AQxmlServlet.getAQProcessor: http_sess=null
              http-8085-Processor4 AQxmlServlet.getAgentName: entry
              http-8085-Processor4 AQxmlServlet.getAgentName: remote host: localhostremote addr: 127.0.0.1
              http-8085-Processor4 AQxmlServlet.getAgentName: remote auth user: null
              http-8085-Processor4 AQxmlServlet.doPost-ex: Exception: oracle.AQ.xml.AQxmlException: JMS-433: User not authenticated

              oracle.AQ.xml.AQxmlException: JMS-433: User not authenticated

                   at oracle.AQ.xml.AQxmlError.throwAQEx(AQxmlError.java:225)
                   at oracle.AQ.xml.AQxmlServlet.getAgentName(AQxmlServlet.java:632)
                   at oracle.AQ.xml.AQxmlServlet.getAQProcessor(AQxmlServlet.java:310)
                   at oracle.AQ.xml.AQxmlServlet.doPost(AQxmlServlet.java:234)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
                   at view.AQXmlServlet22.service(AQXmlServlet22.java:94)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
                   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
                   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                   at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
                   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                   at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
                   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
                   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
                   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                   at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
                   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
                   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                   at java.lang.Thread.run(Thread.java:534)


              Maybe that will help you to see what I am doing wrong.
              • 4. Re: Oracle DB XE Advanced Queuing
                503952
                Today I was successful to access Oracle DB SE 10.2 AQ via AQxmlServlet deployed on Tomcat 4.x. Previous Exception occured because I didn't set up a BASIC authentication to AQxmlServlet deployed on Tomcat. Now, when I set it up, it is working on SE DB.

                But my goal is to use XE DB. I repeated all the steps on XE DB. But the servlet is not working. The thing is that XE does not ship XDK libs, that are needed for AQxmlServlet. I have tried to deploy these libs to Tomcat from JDeveloper versions: 10.1.2, 10.1.3, but I get an exception:

                http-8085-Processor4 AQxmlServlet.doPost-ex: Exception: oracle.xml.sql.OracleXMLSQLException: You are using an old version of the gss library; thus, sql-xml name escaping is not supported.
                oracle.xml.sql.OracleXMLSQLException: You are using an old version of the gss library; thus, sql-xml name escaping is not supported.
                     at oracle.xml.sql.core.OracleXMLUtil.getStructFromXML(OracleXMLUtil.java:223)
                     at oracle.xml.sql.core.OracleXMLUtil.getStructFromXML(OracleXMLUtil.java:181)
                     at oracle.AQ.xml.AQxmlProcessor.enqueueAdtMessages(AQxmlProcessor.java:1860)
                     at oracle.AQ.xml.AQxmlProcessor.enqueueOperation(AQxmlProcessor.java:1114)
                     at oracle.AQ.xml.AQxmlProcessor.performAQoperations(AQxmlProcessor.java:673)
                     at oracle.AQ.xml.AQxmlProcessor.processMessage(AQxmlProcessor.java:381)
                     at oracle.AQ.xml.AQxmlServlet.doPost(AQxmlServlet.java:238)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
                     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
                     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
                     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
                     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
                     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
                     at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
                     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
                     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
                     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
                     at java.lang.Thread.run(Thread.java:534)
                http-8085-Processor4 AQxmlProcessor.writeErrorMessagetoStream: entry
                http-8085-Processor4 AQxmlProcessor.writeErrorMessagetoStream: exit
                StandardManager[XeAqXmlServletApp] AQxmlSessionContext:valueUnBound: : AQxmlSessionContext

                I have tried XDK 10.2.0.2 libs, downloaded from:
                http://www.oracle.com/technology/tech/xml/xdk/software/production10g/index.html
                but these libs are for LINUX (I am using WinXP SP2) and the same exception occured. I have tried DB SE 10.2 libs, also the same exception.

                So my question: how can I set up XDK libs for DB XE 10.2 to run AQxmlServlet. Is it possible? Is AQxmlServlet even tested on XE DB? If so, on which platform and on which webserver?

                Thanks in advance
                • 5. Re: Oracle DB XE Advanced Queuing
                  503952
                  I have found, what I did wrong: not all necessary libs from XDK 10.2.0.2.0 where deployed on Tomcat. When I addinionally deployed these libs:

                  orai18n.jar
                  orai18n-collation.jar
                  orai18n-mapping.jar
                  orai18n-utility.jar

                  AQxmlServler successfuly enqueuned/dequeuned xml message to/from DB XE single consumer queue.