Home » Developer & Programmer » JDeveloper, Java & XML » Runtime error ORA-29515 (Java in Oracle 10.2)
Runtime error ORA-29515 [message #597233] Tue, 01 October 2013 18:37 Go to next message
orabert
Messages: 5
Registered: October 2013
Junior Member
Hi,
I'm kinda new to Java within Oracle, so i realize i could be doing this all wrong. Smile

When i compile the code below, it all compiles happily with no errors.
But when i run the PL/SQL block to call the procedure, it returns the errors:
ORA-29515: exit called from Java code with status 2
ORA-06512: at "MYSCHEMA.IMPORTFILESJAVA", line 1
ORA-06512: at line 2

The official definition of the ORA-29515 error is that my code contains a call to java.lang.Runtime.exitInternal, but i don't see any kind of System.exit type of call anywhere in my Java code... What am i missing?

Thanks!


Java source:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;

public class ImportFiles_form
{
  //Create a JPanel to put combo boxes and labels in
  JPanel cboPanel = new JPanel(new GridLayout(0,2,10,10));

  // Create components to put in the JPanel
  JLabel dataset_lbl = new JLabel("Dataset:");
  String[] datasetNames = runQuery("SELECT DISTINCT dataset FROM data_files");
  JComboBox dataset_cbo = new JComboBox(datasetNames);

  JLabel region_lbl = new JLabel("Region:");
  String[] regionNames = runQuery("SELECT DISTINCT region FROM data_files ORDER BY region");
  JComboBox region_cbo = new JComboBox(regionNames);

  JButton import_btn = new JButton("Import files");

  //Constructor
  public void ImportFiles_form()
  {
    //set default values for combo boxes
    dataset_cbo.setSelectedIndex(0);
    region_cbo.setSelectedIndex(0);

    //Create a button listener
    import_btn.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        //Call the actual operation to import files
        //...nothing here yet...
      }
    });

    cboPanel.add(dataset_lbl);
    cboPanel.add(dataset_cbo);
    cboPanel.add(region_lbl);
    cboPanel.add(region_cbo);
    cboPanel.add(import_btn);

  }

  public String[] runQuery(String query)
  //execute a database query and return a single string array of results
  {
    try
    {
      Connection cnxn = DriverManager.getConnection("jdbc:default:connection:");
      Statement stmt = cnxn.createStatement();
      ResultSet rset = stmt.executeQuery(query);

      //create an ArrayList to hold the results
      ArrayList queryResults = new ArrayList();
      while(rset.next())
      {
        queryResults.add(rset.getString(1));
      }

      //convert the ArrayList to a String[] array
      String[] rval = new String[ queryResults.size() ];
      queryResults.toArray( rval );

      stmt.close();
      cnxn.close();

      //return the String[] array
      return rval;
    }
    catch (SQLException se)
    {
      String[] errMsg = { "ERROR: SQL Exception:" + se.getErrorCode() + "; Message: " + se.getMessage() };
      return errMsg;
    }
  }

  public static void showForm()
  {
    //Construct the class object
    ImportFiles_form importTheFiles = new ImportFiles_form();

    //Create JFrame
    JFrame frame = new JFrame("Import Files");
    frame.getContentPane().add(importTheFiles.cboPanel);
    frame.pack();
    frame.setVisible(true);
  }

}


Oracle procedure:
CREATE OR REPLACE PROCEDURE JavaImportFiles
AS
LANGUAGE JAVA
NAME 'ImportFiles_form.showForm()';


PL/SQL:
BEGIN
  JavaImportFiles;
END;

[Updated on: Wed, 02 October 2013 13:40]

Report message to a moderator

Re: Runtime error ORA-29515 [message #597359 is a reply to message #597233] Thu, 03 October 2013 13:00 Go to previous messageGo to next message
orabert
Messages: 5
Registered: October 2013
Junior Member
K, for anyone else who is asking the same dumb question, at least here is an answer:

Oracle® Database
Java Developer's Guide
10g Release 2 (10.2)
B14187-01

page 1-15:
"A server cannot provide GUIs, but it can provide the logic that drives them. The
Oracle JVM supports only the headless mode of the Java Abstract Window Toolkit
(AWT). All Java AWT classes are available within the server environment and your
programs can use the Java AWT functionality, as long as they do not attempt to
materialize a GUI on the server."

So, yes, i am doing it all wrong.

Thanks.
icon14.gif  Re: Runtime error ORA-29515 [message #597363 is a reply to message #597359] Thu, 03 October 2013 14:03 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Thanks for the feedback (although I didn't understand it but it is just my lack of knowledge in the domain).

Re: Runtime error ORA-29515 [message #598829 is a reply to message #597363] Thu, 17 October 2013 17:33 Go to previous message
orabert
Messages: 5
Registered: October 2013
Junior Member
It means that, as much as i can write all kinds of code using AWT objects, as soon as i try to instantiate an AWT object (i.e. by calling its constructor), that's the same as "materializing a GUI on the server", and hence, not supported by the Java virtual machine.
(simply put: the contents of my 'showForm()' procedure (above) are not permitted inside the JVM.)

If i want to create a GUI, i have to instantiate it outside of the JVM. Smile

[Updated on: Fri, 18 October 2013 11:05]

Report message to a moderator

Previous Topic: XML -- NOT A SINGLE GROUP GROUP FUNCTION
Next Topic: Looping and querying data from XML clob
Goto Forum:
  


Current Time: Thu Mar 28 14:48:19 CDT 2024