ORA-29531: no method %s in class %s call java source in oracle PLSQL











up vote
1
down vote

favorite












The code I have in PLSQL is as:



    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ConversorSQL" AS
package test;
import java.util.Calendar;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import java.io.FileReader;
import java.io.IOException;

public class ConversorSQL {
public static String runConversor(String tipoOperacion, String nombreTabla, String queryOpcional) {
return "Hola";
}
}


And then:



CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
p_tabla VARCHAR2,
p_query VARCHAR2) RETURN VARCHAR2 IS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(String, String, String) return String';


And I call it with:



  SELECT f_conversorSQL( 'Hello there!',
'General Kenobi',
'You are a bold one')
FROM DUAL;


And I get the error in the title:



Error que empieza en la línea 1 del comando:
SELECT f_conversorSQL( 'Hello there!',
'General Kenobi',
'You are a bold one')
FROM DUAL;
Informe de error -
Error SQL: ORA-29531: ningún método runConversor en la clase ConversorSQL
29531. 00000 - "no method %s in class %s"
*Cause: An attempt was made to execute a non_existent method in a Java class.
*Action: Adjust the call or créate the specified method.


I don't understand why it can not reach the method. Both, the JAVA SOURCE and the FUNCTION, compile correctly. But, and this is where the fun begins, this code runs right and dont give me the error



CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "JavaDate" AS
package pruebas;
import java.util.Calendar;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import java.io.FileReader;
import java.io.IOException;

public class JavaDate {
public static String getString(int anho, int mes, int dia, int hora, int minuto, int segundo) {
return "hola";
}
}


Same as before:



    CREATE OR REPLACE FUNCTION f_javadate(p_anho NUMBER,
p_mes NUMBER,
p_dia NUMBER,
p_hora NUMBER,
p_minuto NUMBER,
p_segundo NUMBER) RETURN VARCHAR2 IS LANGUAGE JAVA
NAME 'pruebas.JavaDate.getString(int, int, int, int, int, int) return String';


Same as before too:



SELECT f_javadate(TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')),
TO_NUMBER(TO_CHAR(SYSDATE, 'MM')),
TO_NUMBER(TO_CHAR(SYSDATE, 'DD')),
TO_NUMBER(TO_CHAR(SYSDATE, 'HH24')),
TO_NUMBER(TO_CHAR(SYSDATE, 'MI')),
TO_NUMBER(TO_CHAR(SYSDATE, 'SS')))
FROM DUAL;


They look pretty much the same, I only changed the package name, the function name and the number of parameters.



I'm working with Oracle 11g, the Java version is 1.5.0_10 and the environment is SQL Developer 4.0.1










share|improve this question




























    up vote
    1
    down vote

    favorite












    The code I have in PLSQL is as:



        CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ConversorSQL" AS
    package test;
    import java.util.Calendar;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;

    import java.io.FileReader;
    import java.io.IOException;

    public class ConversorSQL {
    public static String runConversor(String tipoOperacion, String nombreTabla, String queryOpcional) {
    return "Hola";
    }
    }


    And then:



    CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
    p_tabla VARCHAR2,
    p_query VARCHAR2) RETURN VARCHAR2 IS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(String, String, String) return String';


    And I call it with:



      SELECT f_conversorSQL( 'Hello there!',
    'General Kenobi',
    'You are a bold one')
    FROM DUAL;


    And I get the error in the title:



    Error que empieza en la línea 1 del comando:
    SELECT f_conversorSQL( 'Hello there!',
    'General Kenobi',
    'You are a bold one')
    FROM DUAL;
    Informe de error -
    Error SQL: ORA-29531: ningún método runConversor en la clase ConversorSQL
    29531. 00000 - "no method %s in class %s"
    *Cause: An attempt was made to execute a non_existent method in a Java class.
    *Action: Adjust the call or créate the specified method.


    I don't understand why it can not reach the method. Both, the JAVA SOURCE and the FUNCTION, compile correctly. But, and this is where the fun begins, this code runs right and dont give me the error



    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "JavaDate" AS
    package pruebas;
    import java.util.Calendar;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;

    import java.io.FileReader;
    import java.io.IOException;

    public class JavaDate {
    public static String getString(int anho, int mes, int dia, int hora, int minuto, int segundo) {
    return "hola";
    }
    }


    Same as before:



        CREATE OR REPLACE FUNCTION f_javadate(p_anho NUMBER,
    p_mes NUMBER,
    p_dia NUMBER,
    p_hora NUMBER,
    p_minuto NUMBER,
    p_segundo NUMBER) RETURN VARCHAR2 IS LANGUAGE JAVA
    NAME 'pruebas.JavaDate.getString(int, int, int, int, int, int) return String';


    Same as before too:



    SELECT f_javadate(TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')),
    TO_NUMBER(TO_CHAR(SYSDATE, 'MM')),
    TO_NUMBER(TO_CHAR(SYSDATE, 'DD')),
    TO_NUMBER(TO_CHAR(SYSDATE, 'HH24')),
    TO_NUMBER(TO_CHAR(SYSDATE, 'MI')),
    TO_NUMBER(TO_CHAR(SYSDATE, 'SS')))
    FROM DUAL;


    They look pretty much the same, I only changed the package name, the function name and the number of parameters.



    I'm working with Oracle 11g, the Java version is 1.5.0_10 and the environment is SQL Developer 4.0.1










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      The code I have in PLSQL is as:



          CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ConversorSQL" AS
      package test;
      import java.util.Calendar;
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;

      import java.io.FileReader;
      import java.io.IOException;

      public class ConversorSQL {
      public static String runConversor(String tipoOperacion, String nombreTabla, String queryOpcional) {
      return "Hola";
      }
      }


      And then:



      CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
      p_tabla VARCHAR2,
      p_query VARCHAR2) RETURN VARCHAR2 IS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(String, String, String) return String';


      And I call it with:



        SELECT f_conversorSQL( 'Hello there!',
      'General Kenobi',
      'You are a bold one')
      FROM DUAL;


      And I get the error in the title:



      Error que empieza en la línea 1 del comando:
      SELECT f_conversorSQL( 'Hello there!',
      'General Kenobi',
      'You are a bold one')
      FROM DUAL;
      Informe de error -
      Error SQL: ORA-29531: ningún método runConversor en la clase ConversorSQL
      29531. 00000 - "no method %s in class %s"
      *Cause: An attempt was made to execute a non_existent method in a Java class.
      *Action: Adjust the call or créate the specified method.


      I don't understand why it can not reach the method. Both, the JAVA SOURCE and the FUNCTION, compile correctly. But, and this is where the fun begins, this code runs right and dont give me the error



      CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "JavaDate" AS
      package pruebas;
      import java.util.Calendar;
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;

      import java.io.FileReader;
      import java.io.IOException;

      public class JavaDate {
      public static String getString(int anho, int mes, int dia, int hora, int minuto, int segundo) {
      return "hola";
      }
      }


      Same as before:



          CREATE OR REPLACE FUNCTION f_javadate(p_anho NUMBER,
      p_mes NUMBER,
      p_dia NUMBER,
      p_hora NUMBER,
      p_minuto NUMBER,
      p_segundo NUMBER) RETURN VARCHAR2 IS LANGUAGE JAVA
      NAME 'pruebas.JavaDate.getString(int, int, int, int, int, int) return String';


      Same as before too:



      SELECT f_javadate(TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'MM')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'DD')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'HH24')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'MI')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'SS')))
      FROM DUAL;


      They look pretty much the same, I only changed the package name, the function name and the number of parameters.



      I'm working with Oracle 11g, the Java version is 1.5.0_10 and the environment is SQL Developer 4.0.1










      share|improve this question















      The code I have in PLSQL is as:



          CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ConversorSQL" AS
      package test;
      import java.util.Calendar;
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;

      import java.io.FileReader;
      import java.io.IOException;

      public class ConversorSQL {
      public static String runConversor(String tipoOperacion, String nombreTabla, String queryOpcional) {
      return "Hola";
      }
      }


      And then:



      CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
      p_tabla VARCHAR2,
      p_query VARCHAR2) RETURN VARCHAR2 IS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(String, String, String) return String';


      And I call it with:



        SELECT f_conversorSQL( 'Hello there!',
      'General Kenobi',
      'You are a bold one')
      FROM DUAL;


      And I get the error in the title:



      Error que empieza en la línea 1 del comando:
      SELECT f_conversorSQL( 'Hello there!',
      'General Kenobi',
      'You are a bold one')
      FROM DUAL;
      Informe de error -
      Error SQL: ORA-29531: ningún método runConversor en la clase ConversorSQL
      29531. 00000 - "no method %s in class %s"
      *Cause: An attempt was made to execute a non_existent method in a Java class.
      *Action: Adjust the call or créate the specified method.


      I don't understand why it can not reach the method. Both, the JAVA SOURCE and the FUNCTION, compile correctly. But, and this is where the fun begins, this code runs right and dont give me the error



      CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "JavaDate" AS
      package pruebas;
      import java.util.Calendar;
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;

      import java.io.FileReader;
      import java.io.IOException;

      public class JavaDate {
      public static String getString(int anho, int mes, int dia, int hora, int minuto, int segundo) {
      return "hola";
      }
      }


      Same as before:



          CREATE OR REPLACE FUNCTION f_javadate(p_anho NUMBER,
      p_mes NUMBER,
      p_dia NUMBER,
      p_hora NUMBER,
      p_minuto NUMBER,
      p_segundo NUMBER) RETURN VARCHAR2 IS LANGUAGE JAVA
      NAME 'pruebas.JavaDate.getString(int, int, int, int, int, int) return String';


      Same as before too:



      SELECT f_javadate(TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'MM')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'DD')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'HH24')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'MI')),
      TO_NUMBER(TO_CHAR(SYSDATE, 'SS')))
      FROM DUAL;


      They look pretty much the same, I only changed the package name, the function name and the number of parameters.



      I'm working with Oracle 11g, the Java version is 1.5.0_10 and the environment is SQL Developer 4.0.1







      java sql plsql oracle11g






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago









      user7294900

      16.8k92954




      16.8k92954










      asked 2 hours ago









      Miguel NoTeimporta

      254




      254
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          To call java source function use CALL:



           VARIABLE myString VARCHAR2(20);
          CALL f_conversorSQL( 'Hello there!',
          'General Kenobi',
          'You are a bold one')
          INTO :myString;



          Call the stored procedure, as follows:



          SQL> VARIABLE myString VARCHAR2(20);

          SQL> CALL helloworld() INTO :myString;


          statement performs a top-level call in Oracle Database. SQL and PL/SQL see no difference between a stored procedure that is written in Java, PL/SQL, or any other language.




          Define the function with java.lang.String:



          CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
          p_tabla VARCHAR2,
          p_query VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';





          share|improve this answer























          • I've just tried, didn't work either. Same error.
            – Miguel NoTeimporta
            2 hours ago










          • @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
            – user7294900
            1 hour ago










          • Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
            – Miguel NoTeimporta
            1 hour ago








          • 1




            @MiguelNoTeimporta you don't have to use tge return but it's returning a value
            – user7294900
            1 hour ago











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204456%2fora-29531-no-method-s-in-class-s-call-java-source-in-oracle-plsql%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          To call java source function use CALL:



           VARIABLE myString VARCHAR2(20);
          CALL f_conversorSQL( 'Hello there!',
          'General Kenobi',
          'You are a bold one')
          INTO :myString;



          Call the stored procedure, as follows:



          SQL> VARIABLE myString VARCHAR2(20);

          SQL> CALL helloworld() INTO :myString;


          statement performs a top-level call in Oracle Database. SQL and PL/SQL see no difference between a stored procedure that is written in Java, PL/SQL, or any other language.




          Define the function with java.lang.String:



          CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
          p_tabla VARCHAR2,
          p_query VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';





          share|improve this answer























          • I've just tried, didn't work either. Same error.
            – Miguel NoTeimporta
            2 hours ago










          • @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
            – user7294900
            1 hour ago










          • Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
            – Miguel NoTeimporta
            1 hour ago








          • 1




            @MiguelNoTeimporta you don't have to use tge return but it's returning a value
            – user7294900
            1 hour ago















          up vote
          1
          down vote



          accepted










          To call java source function use CALL:



           VARIABLE myString VARCHAR2(20);
          CALL f_conversorSQL( 'Hello there!',
          'General Kenobi',
          'You are a bold one')
          INTO :myString;



          Call the stored procedure, as follows:



          SQL> VARIABLE myString VARCHAR2(20);

          SQL> CALL helloworld() INTO :myString;


          statement performs a top-level call in Oracle Database. SQL and PL/SQL see no difference between a stored procedure that is written in Java, PL/SQL, or any other language.




          Define the function with java.lang.String:



          CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
          p_tabla VARCHAR2,
          p_query VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';





          share|improve this answer























          • I've just tried, didn't work either. Same error.
            – Miguel NoTeimporta
            2 hours ago










          • @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
            – user7294900
            1 hour ago










          • Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
            – Miguel NoTeimporta
            1 hour ago








          • 1




            @MiguelNoTeimporta you don't have to use tge return but it's returning a value
            – user7294900
            1 hour ago













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          To call java source function use CALL:



           VARIABLE myString VARCHAR2(20);
          CALL f_conversorSQL( 'Hello there!',
          'General Kenobi',
          'You are a bold one')
          INTO :myString;



          Call the stored procedure, as follows:



          SQL> VARIABLE myString VARCHAR2(20);

          SQL> CALL helloworld() INTO :myString;


          statement performs a top-level call in Oracle Database. SQL and PL/SQL see no difference between a stored procedure that is written in Java, PL/SQL, or any other language.




          Define the function with java.lang.String:



          CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
          p_tabla VARCHAR2,
          p_query VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';





          share|improve this answer














          To call java source function use CALL:



           VARIABLE myString VARCHAR2(20);
          CALL f_conversorSQL( 'Hello there!',
          'General Kenobi',
          'You are a bold one')
          INTO :myString;



          Call the stored procedure, as follows:



          SQL> VARIABLE myString VARCHAR2(20);

          SQL> CALL helloworld() INTO :myString;


          statement performs a top-level call in Oracle Database. SQL and PL/SQL see no difference between a stored procedure that is written in Java, PL/SQL, or any other language.




          Define the function with java.lang.String:



          CREATE OR REPLACE FUNCTION f_conversorSQL(p_tipo VARCHAR2,
          p_tabla VARCHAR2,
          p_query VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'test.ConversorSQL.runConversor(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 hours ago

























          answered 2 hours ago









          user7294900

          16.8k92954




          16.8k92954












          • I've just tried, didn't work either. Same error.
            – Miguel NoTeimporta
            2 hours ago










          • @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
            – user7294900
            1 hour ago










          • Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
            – Miguel NoTeimporta
            1 hour ago








          • 1




            @MiguelNoTeimporta you don't have to use tge return but it's returning a value
            – user7294900
            1 hour ago


















          • I've just tried, didn't work either. Same error.
            – Miguel NoTeimporta
            2 hours ago










          • @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
            – user7294900
            1 hour ago










          • Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
            – Miguel NoTeimporta
            1 hour ago








          • 1




            @MiguelNoTeimporta you don't have to use tge return but it's returning a value
            – user7294900
            1 hour ago
















          I've just tried, didn't work either. Same error.
          – Miguel NoTeimporta
          2 hours ago




          I've just tried, didn't work either. Same error.
          – Miguel NoTeimporta
          2 hours ago












          @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
          – user7294900
          1 hour ago




          @MiguelNoTeimporta did you succeeded? also updated to define the function with java.lang.String
          – user7294900
          1 hour ago












          Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
          – Miguel NoTeimporta
          1 hour ago






          Yes! It worked! But why it is not necessary to put on the return part? Thanks a lot!
          – Miguel NoTeimporta
          1 hour ago






          1




          1




          @MiguelNoTeimporta you don't have to use tge return but it's returning a value
          – user7294900
          1 hour ago




          @MiguelNoTeimporta you don't have to use tge return but it's returning a value
          – user7294900
          1 hour ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204456%2fora-29531-no-method-s-in-class-s-call-java-source-in-oracle-plsql%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)