6 Replies Latest reply: Oct 31, 2012 5:12 AM by John-MK RSS

    ORA-29532: Java call terminated by uncaught Java exception

    John-MK
      Hi Folks,

      In order to use Oracle Webservices, I loaded JAVA CLASSES in the db through loadjava command into SYS schema and grant all the related permissions to one of the user. I created one example function and when I do SELECT, I get the following error:

      I am very poor in PL/SQL stuff, what this error suggest to you.

      Thanks a lot in advance.
      SQL> Select GETDATAFROMWEBSERVICE from Dual;
      Select GETDATAFROMWEBSERVICE from Dual
              *
      ERROR at line 1:
      ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalAccessException: java.lang.NoClassDefFoundError: !!!ERROR!!! generated by genmissing
      ORA-06512: at "SYS.UTL_DBWS", line 144
      ORA-06512: at "DBWS.GETDATAFROMWEBSERVICE", line 16
      Though this page is in German, but in case if you want to locate for example line 16, please refer it.
      http://www.theserverside.de/oracle-webservices-im-praktischen-einsatz/
      
          CREATE OR REPLACE FUNCTION GETDATAFROMWEBSERVICE RETURN VARCHAR2 IS
            v_service             UTL_DBWS.SERVICE;
            v_call                UTL_DBWS.CALL;
            v_service_qname       UTL_DBWS.QNAME;
            v_port_qname          UTL_DBWS.QNAME;
            v_operation_qname     UTL_DBWS.QNAME;
            v_string_type_qname   UTL_DBWS.QNAME;
            v_decimal_type_qname  UTL_DBWS.QNAME;
            v_ret                 ANYDATA;
            v_retx_string         VARCHAR2(100);
            v_retx_len            NUMBER;
            v_params              UTL_DBWS.ANYDATA_LIST;
          BEGIN
            -- Service-Instanz erzeugen...
            v_service_qname := UTL_DBWS.TO_QNAME('http://www.webserviceX.NET', 'GlobalWeather');
            v_service       := UTL_DBWS.CREATE_SERVICE(v_service_qname);
           
            -- Call-Instanz erzeugen...
            v_port_qname      := UTL_DBWS.TO_QNAME('http://www.webserviceX.NET', 'GlobalWeatherSoap');
            v_operation_qname := UTL_DBWS.TO_QNAME('http://www.webserviceX.NET', 'GetWeather');
            v_call := UTL_DBWS.CREATE_CALL(v_service, v_port_qname, v_operation_qname);
           
            -- Eigenschaften festlegen...
            UTL_DBWS.SET_TARGET_ENDPOINT_ADDRESS(v_call,
                     'http://www.webservicex.net/globalweather.asmx');
            UTL_DBWS.SET_PROPERTY(v_call, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
           
            -- Parameter hinzufuegen...
            v_string_type_qname := UTL_DBWS.TO_QNAME('http://www.w3.org/2001/XMLSchema', 'string');
            UTL_DBWS.ADD_PARAMETER(v_call, 'param0', v_string_type_qname, 'ParameterMode.IN');
            UTL_DBWS.ADD_PARAMETER(v_call, 'param1', v_string_type_qname, 'ParameterMode.IN');
           
            -- Return-Typ festlegen...
            v_decimal_type_qname := UTL_DBWS.TO_QNAME('http://www.w3.org/2001/XMLSchema', 'string');
            UTL_DBWS.SET_RETURN_TYPE(v_call, v_decimal_type_qname);
           
            -- Web-Service starten...
            v_params(0) := ANYDATA.CONVERTVARCHAR('Hamburg');
            v_params(1) := ANYDATA.CONVERTVARCHAR('Germany');
            v_ret := UTL_DBWS.INVOKE(v_call, v_params); 
            DBMS_OUTPUT.PUT_LINE('Result: ' || v_ret.accessvarchar2 );
            UTL_DBWS.RELEASE_SERVICE(v_service);
            RETURN v_ret.accessvarchar2;
          END;
          /
      Best Regards
        • 1. Re: ORA-29532: Java call terminated by uncaught Java exception
          AlexAnd
          looks like you installed UTL_DBWS incorrectly or it's corrupted

          you need appropriate UTL_DBWS *jar's for your db
          http://www.oracle-base.com/articles/10g/utl_dbws-10g.php

          step by step in mos
          Getting ORA-29532 java.lang.IllegalAccessException: java.lang.NoClassDefFoundError: !!!ERROR!!! message from UTL_DBWS call [ID 780371.1]
          • 2. Re: ORA-29532: Java call terminated by uncaught Java exception
            John-MK
            Hello,

            Thank you very much. Your suggestion is very helpful. I followed the note id you suggested:

            Just 2,3 days ago I installed java classes and this related procedure.

            - Dropping, running initxml.sql scropt and using loadjava command again.
            [oracle@db lib]$ dropjava -u sys/db5 -v -s dbwsclientws.jar dbwsclientdb102.jar
            dropping: resource META-INF/MANIFEST.MF
            dropping: synonym for resource META-INF/MANIFEST.MF
            dropping: resource META-INF/services/javax.xml.parsers.DocumentBuilderFactory
            dropping: synonym for resource META-INF/services/javax.xml.parsers.DocumentBuilderFactory
            dropping: resource META-INF/services/javax.xml.parsers.SAXParserFactory
            - - - 
            # sqlplus / as sysdba
            SQL> @/oracle/app/product/10.2.0/db_home/xdk/admin/initxml.sql
            
            PL/SQL procedure successfully completed.
            - - SQL> connect dbws
            Enter password: 
            Connected.
            SQL>  CREATE OR REPLACE FUNCTION XMLVersion RETURN VARCHAR2 IS  LANGUAGE JAVA NAME 
              2   'oracle.xml.parser.v2.XMLParser.getReleaseVersion() returns java.lang.String'; 
              3  /
            
            Function created.
            
            # This query was running error before, now looks good.
            SQL>  select XMLVersion from dual;
            
            XMLVERSION
            -------------------------------------------------------------
            Oracle XML Developers Kit 10.2.0.5.0 - Production
            
            # Therefore, again loaded Java Classes
            [oracle@testdb1vm lib]$ loadjava -u sys/db -r -v -f -s -grant public -genmissing dbwsclientws.jar dbwsclientdb102.jar
            arguments: '-u' 'sys/***' '-r' '-v' '-f' '-s' '-grant' 'public' '-genmissing' 'dbwsclientws.jar' 'dbwsclientdb102.jar' 
            creating : resource META-INF/MANIFEST.MF
            loading  : resource META-INF/MANIFEST.MF
            creating : resource META-INF/services/javax.xml.parsers.DocumentBuilderFactory
            loading  : resource META-INF/services/javax.xml.parsers.DocumentBuilderFactory
            - - 
            Classes Loaded: 3991
            Resources Loaded: 81
            Sources Loaded: 0
            Published Interfaces: 0
            Classes generated: 0
            Classes skipped: 0
            Synonyms Created: 4072
            Errors: 0
            
            [oracle@testdb1vm ~]$ sqlplus dbws
            
            SQL*Plus: Release 10.2.0.5.0 - Production on Tue Oct 30 10:20:59 2012
            
            Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
            
            Enter password: 
            
            Connected to:
            Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
            With the Partitioning, OLAP, Data Mining and Real Application Testing options
            
            # Function add_numbers created as in the example to test (http://www.oracle-base.com/articles/10g/utl_dbws-10g.php) ## But getting error again. 
            SQL> @add_nrs.sql
            
            Function created.
            
            SQL> SELECT add_numbers(1, 5) FROM dual;
            SELECT add_numbers(1, 5) FROM dual
                   *
            ERROR at line 1:
            ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2ee.ws.common.tools.api.WsdlValidationException: Failed to read wsdl file at: "http://www.oracle-base.com/webservices/server.php?wsdl", caused by: java.net.NoRouteToHostException.
            ORA-06512: at "SYS.UTL_DBWS", line 159
            ORA-06512: at "SYS.UTL_DBWS", line 156
            ORA-06512: at "DBWS.ADD_NUMBERS", line 25
            Could you please suggest, what is getting wrong me or or what to do here?

            Thanks a lot.

            Best Regards
            • 3. Re: ORA-29532: Java call terminated by uncaught Java exception
              AlexAnd
              did you instal correct version of jar's?
              did you install latest jar's from dbws-callout-utility-10131.zip ?

              i didn't check it for 10.2
              i installed it for 11.2 and used dbws-callout-utility-10131.zip


              from above script i can't see creating of package
              utl_dbws_decl.sql
              utl_dbws_body.sql

              i heard what package create then loadjava but may be re-create manually?

              also grant to dbws
              SQL> CREATE PUBLIC SYNONYM utl_dbws FOR sys.utl_dbws;
              SQL> GRANT EXECUTE ON sys.utl_dbws TO dbws;
              for me (11.2)
              CREATE OR REPLACE FUNCTION add_numbers
              ...
              work fine
              SQL> select add_numbers(2,5) from dual;
              
              ADD_NUMBERS(2,5)
              ----------------
                             7
              
              SQL>
              also plz see
              DBWS Callout Utility Throws 'unknown port type' Parsing WSDL [ID 1118897.1]
              • 4. Re: ORA-29532: Java call terminated by uncaught Java exception
                John-MK
                Thanks.

                I again used dropjava,run initxml.sql scropt,utl_dbws_decl/body .sql scripts,public synonym,Execute grants to user jon, permissions as in mos note id. This ADD_NUMBERS function works now. But why this GETDATAFROMWEBSERVICE is not working here ( http://www.theserverside.de/oracle-webservices-im-praktischen-einsatz/ )
                JOHN@db > r
                  1* SELECT add_numbers(12,18) from dual
                
                ADD_NUMBERS(12,18)
                ------------------
                          30
                
                JOHN@db > Select  GETDATAFROMWEBSERVICE from Dual;   (Same as above link: http://www.theserverside.de/oracle-webservices-im-praktischen-einsatz/ )
                Select     GETDATAFROMWEBSERVICE from Dual
                        *
                FEHLER in Zeile 1:
                ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
                at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
                at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
                at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
                at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
                ORA-06512: in "SYS.UTL_DBWS", Zeile 388
                ORA-06512: in "SYS.UTL_DBWS", Zeile 385
                ORA-06512: in "JOHN.GETDATAFROMWEBSERVICE", Zeile 40
                Best Regards

                Edited by: K-Saf on Oct 30, 2012 12:45 PM

                Edited by: K-Saf on Oct 30, 2012 12:46 PM
                • 5. Re: ORA-29532: Java call terminated by uncaught Java exception
                  AlexAnd
                  >
                  This ADD_NUMBERS function works now.
                  >
                  nice :)

                  >
                  JOHN@db > Select GETDATAFROMWEBSERVICE from Dual; (Same as above link: http://www.theserverside.de/oracle-webservices-im-praktischen-einsatz/ )
                  Select     GETDATAFROMWEBSERVICE from Dual
                  *
                  FEHLER in Zeile 1:
                  ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
                  at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
                  at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
                  at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
                  at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
                  ORA-06512: in "SYS.UTL_DBWS", Zeile 388
                  ORA-06512: in "SYS.UTL_DBWS", Zeile 385
                  ORA-06512: in "JOHN.GETDATAFROMWEBSERVICE", Zeile 40
                  >
                  check your soap request which forming by UTL_DBWS


                  for parameters i prefer another way as in sample for celciusToFahrenheit from
                  Using UTL_DBWS to Make a Database 11g Callout to a Document Style Web Service [ID 841183.1]

                  or like
                  l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
                      <ws_add xmlns="' || l_namespace || '">
                        <int1>' || p_int_1 || '</int1>
                        <int2>' || p_int_2 || '</int2>
                      </ws_add>');
                  from http://www.oracle-base.com/articles/10g/utl_dbws-10g.php

                  or
                  especially for your case
                  request := xmltype('<GetWeather xmlns="http://www.webserviceX.NET">
                   <CityName>' || city || '</CityName>
                   <CountryName>' || country || '</CountryName>
                   </GetWeather>');
                  from http://www.wiesbaum.org/?p=226
                  • 6. Re: ORA-29532: Java call terminated by uncaught Java exception
                    John-MK
                    I added following two lines to avoid the same error also described in this note ( SOAPFaultException When Invoking .NET Web Service from Database / UTL_DBWS [ID 558439.1] )

                    # Added at the top of function GETDATAFROMWEBSERVICES as in previous posts. I dropped the function, created with following lines and run : SELECT GETDATAFROMSERVICES from dual. but still getting error :(
                    sys.utl_dbws.set_property(v_call, 'SOAPACTION_USE', 'TRUE');
                    sys.utl_dbws.set_property(v_call, 'SOAPACTION_URI', 'http://www.webserviceX.NET'/'GlobalWeather');
                    JOHN@db > Select  GETDATAFROMWEBSERVICE from Dual;
                    Select     GETDATAFROMWEBSERVICE from Dual
                            *
                    FEHLER in Zeile 1:
                    ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException
                    ORA-06512: in "SYS.UTL_DBWS", Line 319
                    ORA-06512: in "JOHN.GETDATAFROMWEBSERVICE", Line 16
                    Thank you.

                    Best Regards

                    Edited by: K-Saf on Oct 31, 2012 11:12 AM