0

if we create a java source using below way in oracle

CREATE JAVA SOURCE NAMED "Welcome" AS
  public class Welcome {
  public static String welcome() {
  System.out.println("Welcome ");  } 
}
/

Where can i see the message ?

Reason for Why I am asking for this Question is .

Right now I am debugging one Email Sending Application(Alerts). The application is working fine for the alerts doesnt have any attachment, but if there is any attachment I am getting Java call Terminated by uncaught Java Exception java.lang.NoClassDefFoundError

The application Flow is as below

  1. PLSQL Package (Here we fetch all the data and call Java Source)
  2. JAVA Source (XXABC_SENDMAIL.sendMail is use to send the mail)

When I put DBMS.output I can reach till the point where JAVA source call is happening , but i need to find , at exactly which place the JAVA error is getting thrown.

F0cus
  • 585
  • 3
  • 18
  • 52
  • 3
    Possible duplicate of [where does system.out.println output goes in oracle java class](https://stackoverflow.com/questions/4267545/where-does-system-out-println-output-goes-in-oracle-java-class) – OldProgrammer Jul 08 '17 at 16:28
  • Actually .. I have already seen that question, there they use Load java command to load the JAVA class into Oracle, but this is almost like PLSQL code but java code in it – F0cus Jul 08 '17 at 16:36
  • Your final paragraph is not clear. Are you saying you already tried using dbms_output.get_lines and it is *not* returning what you expect? If it's only sometimes that you can get stdout, then state clearly the entire stack when everything is ok and then state clearly the entire stack when everything is not ok. – Jeff Holt Jul 08 '17 at 16:59
  • Hi Jeff, I have added more clear explanation, let me know if you need any other clarification – F0cus Jul 08 '17 at 17:12
  • Is your code snippet supposed to illustrate something? – William Robertson Jul 09 '17 at 09:33
  • Hi william, Yes.. if we have a similar code, then how to dedub? How to print that `System.out.println` ? in normal PLSQL i use `dbms_output.put_line` or `insert` statment to debug, but how to debug this java source ? pls provide a idean – F0cus Jul 10 '17 at 07:43

1 Answers1

0

I got the EXACT answer from the below link.. http://blogs.dayneo.co.za/2012/11/simplest-way-to-debug-your-oracle-java.html

Direct from the Link

dayneo@RMSD> CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED SimpleSample as
  2  public class SimpleSample
  3  {
  4    public static void simplemsg()
  5    {
  6      System.out.println(new java.util.Date().toString() + ": Hello world!");
  7    }
  8  }
  9  /

Java created.

dayneo@RMSD> create or replace procedure simplesample_says as
  2  language java name 'SimpleSample.simplemsg()';
  3  /

Procedure created.

dayneo@RMSD> set serveroutput on size 1000000
dayneo@RMSD> call dbms_java.set_output(1000000);

Call completed.

dayneo@RMSD> begin
  2     simplesample_says();
  3  end;
  4  /
Mon Nov 05 15:37:03 GMT+02:00 2012: Hello world!

PL/SQL procedure successfully completed.

its more or less the same as the

Stack overflow question "where does system.out.println output goes in oracle java class"

but I feel the link fits 100% to my question.

F0cus
  • 585
  • 3
  • 18
  • 52