Oracle - Java/JSERVER - Debug Load / Compilation

Card Puncher Data Processing

About

When you load Java unit, you can get such error:

java.sql.SQLException: ORA-24344: success with compilation error
ORA-06512: at line 1

	at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
	at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
       ...........

How can we resolve this error ?

How to get the error ?

select name, type, sequence, substr(text,0,100) from user_errors;

Result:

NAME“TYPE”“SEQUENCE”“SUBSTR(TEXT,0,100)”
com/ciber/Salesforce“JAVA CLASS”1“ORA-29535: source requires recompilation”
Salesforce“JAVA SOURCE”1“Salesforce:74: incompatible types”
Salesforce“JAVA SOURCE”2“found : int”
Salesforce“JAVA SOURCE”3“required: java.lang.Integer”
Salesforce“JAVA SOURCE”4“ Integer countLine = 0;”
Salesforce“JAVA SOURCE”5“ ”
Salesforce“JAVA SOURCE”6“Salesforce:75: incompatible types”
Salesforce“JAVA SOURCE”7“found : int”
Salesforce“JAVA SOURCE”8“required: java.lang.Integer”
Salesforce“JAVA SOURCE”9“ Integer nbHeaderSeparator = 0;”
Salesforce“JAVA SOURCE”10“ ”
Salesforce“JAVA SOURCE”11“Salesforce:76: incompatible types”
Salesforce“JAVA SOURCE”12“found : int”
Salesforce“JAVA SOURCE”13“required: java.lang.Integer”
Salesforce“JAVA SOURCE”14“ Integer nbSeparator = 0;”
Salesforce“JAVA SOURCE”15“ ”
Salesforce“JAVA SOURCE”16“Salesforce:79: operator ++ cannot be applied to java.lang.Integer”
Salesforce“JAVA SOURCE”17“ countLine++;”
Salesforce“JAVA SOURCE”18“ ”
Salesforce“JAVA SOURCE”19“Salesforce:84: operator ++ cannot be applied to java.lang.Integer”
Salesforce“JAVA SOURCE”20“ nbSeparator++;”
Salesforce“JAVA SOURCE”21“ ”
Salesforce“JAVA SOURCE”22“Salesforce:87: operator == cannot be applied to java.lang.Integer,int”
Salesforce“JAVA SOURCE”23“ if (countLine == 1) {”
Salesforce“JAVA SOURCE”24“ ”
Salesforce“JAVA SOURCE”25“Salesforce:92: incompatible types”
Salesforce“JAVA SOURCE”26“found : int”
Salesforce“JAVA SOURCE”27“required: java.lang.Integer”
Salesforce“JAVA SOURCE”28“ nbSeparator = 0;”
Salesforce“JAVA SOURCE”29“ ”
Salesforce“JAVA SOURCE”30“Salesforce:95: operator - cannot be applied to java.lang.Integer,int”
Salesforce“JAVA SOURCE”31“ nbSeparator = nbSeparator - 1;”
Salesforce“JAVAOURCE”32“ ”
Salesforce“JAVA SOURCE”33“8 errors”

Solution in this case: change integer with int in the java class

Integer countLine = 0;

was become

int countLine = 0;

How to resolve the java class ?

First, get the correct name of the object:

select object_name, object_type, status
from user_objects
where object_type like '%JAVA%';

Then resolve it:

Before resolution of the problem:

SQL> alter java class "com/gerardnico/Salesforce" resolve;

Warning: Java altered with compilation errors.

After the resolution:

SQL> alter java class "com/gerardnico/Salesforce" resolve;

Java altered.

Redirecting the output to SQL*Plus Text Buffer

As in previous releases, you can use the DBMS_JAVA package procedure SET_OUTPUT to redirect output to the SQL*Plus text buffer:

SET SERVEROUTPUT ON
CALL dbms_java.set_output(2000);

The minimum and default buffer size is 2,000 bytes and the maximum size is 1,000,000 bytes. In the following example, the buffer size is increased to 5,000 bytes:

SQL> SET SERVEROUTPUT ON SIZE 5000
SQL> CALL dbms_java.set_output(5000);

The output is displayed at the end of the call.

Example of result:

SQL> call AlterSalesforceFile();
AlterSalesforceFile started
Error: the Permission (java.io.FilePermission /transfer/salesforce_original read) 
has not been granted to STG. The PL/SQL to grant this is dbms_java.grant_permission( 'STG', 
'SYS:java.io.FilePermission', '/transfer/salesforce_original', 'read' )

Call completed.

Documentation / Reference





Discover More
Card Puncher Data Processing
Oracle - Java

Oracle® Database Java Developer's Guide 10g Release 2 (10.2) Oracle®...



Share this page:
Follow us:
Task Runner