Invalid Java Class objects and ORA-29534

An Oracle 19C system has been patched with the following patches “JDK BUNDLE PATCH 19.0.0.0.210119” and “OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)

Patch  32162391     : applied on Wed Feb 17 13:49:21 PST 2021
Unique Patch ID:  24008701
Patch description:  "JDK BUNDLE PATCH 19.0.0.0.210119"
   Created on 15 Dec 2020, 23:11:32 hrs PST8PDT
   Bugs fixed:
     32162391
   This patch overlays patches:
     29834717, 30087906, 30125133, 30080447, 31666885, 31281355, 31771877
     30557433, 31212138, 31667176, 30797938, 31204483, 30446228, 30446054
     32066676, 32072711, 30830913, 30869156, 32218454

Patch  32067171     : applied on Wed Feb 17 13:46:16 PST 2021
Unique Patch ID:  23947975
Patch description:  "OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)"
   Created on 2 Dec 2020, 09:24:57 hrs UTC
   Bugs fixed:
     29445548, 29254623, 29540327, 29774362, 30134746, 30160625, 30534662
     29512125, 29942275, 30855101, 31306261, 31359215, 30895577, 29224710
     26716835, 31668872, 32165759, 32069696, 32032733, 30889443, 30674373

After that, there were 202 invalid objects within the DB with the object_type “JAVA CLASS” (101 objects) and “SYNONYM” (101 objects)”.

SQL> select count(*), owner, OBJECT_TYPE from dba_objects where status='INVALID' group by owner, OBJECT_TYPE;

COUNT(*)	OWNER      		OBJECT_TYPE
----------     ----------------		----------------------
101		SYS			JAVA CLASS
101		PUBLIC			SYNONYM

SQL> select owner, OBJECT_NAME, OBJECT_TYPE, created, STATUS from dba_objects where status='INVALID';

OWNER      OBJECT_NAME                                                  OBJECT_TYPE             CREATED   STATUS
---------- ------------------------------------------------------------ ----------------------- --------- -------
SYS        oracle/AQ/AQOracleAdmin                                      JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/AQ/AQOracleDriver                                     JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/AQ/AQOracleMessage                                    JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/AQ/AQOracleObjectPayload                              JAVA CLASS              02-FEB-21 INVALID
.
.
.
SYS        oracle/jms/AQjmsAdtMessage                                   JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsAgent                                        JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsBytesMessage_C                               JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsBytesMessage                                 JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsBytesMessages_C                              JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsClientSubscriberMap                          JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsConnection                                   JAVA CLASS              02-FEB-21 INVALID
SYS        oracle/jms/AQjmsConnectionFactory                            JAVA CLASS              02-FEB-21 INVALID
.
.
.
PUBLIC     oracle/AQ/AQOracleAdmin                                      SYNONYM                 02-FEB-21 INVALID
PUBLIC     oracle/AQ/AQOracleDriver                                     SYNONYM                 02-FEB-21 INVALID
PUBLIC     oracle/AQ/AQOracleMessage                                    SYNONYM                 02-FEB-21 INVALID
PUBLIC     oracle/AQ/AQOracleObjectPayload                              SYNONYM                 02-FEB-21 INVALID
.
.
.
PUBLIC     oracle/jms/GenMsgSupport                                     SYNONYM                 02-FEB-21 INVALID
PUBLIC     oracle/jms/ParseException                                    SYNONYM                 02-FEB-21 INVALID
PUBLIC     oracle/jms/SelectorToRule                                    SYNONYM                 02-FEB-21 INVALID
PUBLIC     oracle/jms/WebLogicHelper                                    SYNONYM                 02-FEB-21 INVALID

Not sure what happened and why. The dbms_java package seemed good because I could use dbms_java.longname(object_name) on dba_objects.

SQL> SELECT dbms_java.longname (object_name) longname  
FROM user_objects WHERE object_type = 'JAVA CLASS' AND status = 'INVALID';

LONGNAME
----------------------------------------------------------------------
oracle/AQ/AQOracleAdmin
oracle/AQ/AQOracleDriver
oracle/AQ/AQOracleMessage
oracle/AQ/AQOracleObjectPayload
oracle/AQ/AQOracleQueue
.
.
oracle/jms/GenMsgSupport
oracle/jms/ParseException
oracle/jms/SelectorToRule
oracle/jms/WebLogicHelper

101 rows selected.

Checked dba_registryJServer JAVA Virtual Machine was valid, but Oracle Database Java Packages was invalid and Oracle XDK was missing.

SQL> select comp_id, comp_name, version, status from dba_registry order by 1;

COMP_ID        COMP_NAME                                VERSION             STATUS
-------------  ---------------------------------------  ------------------  --------------------
CATALOG        Oracle Database Catalog Views            19.0.0.0.0          VALID
CATJAVA        Oracle Database Java Packages            19.0.0.0.0          INVALID
CATPROC        Oracle Database Packages and Types       19.0.0.0.0          VALID
JAVAVM         JServer JAVA Virtual Machine             19.0.0.0.0          VALID
OWM            Oracle Workspace Manager                 19.0.0.0.0          VALID
RAC            Oracle Real Application Clusters         19.0.0.0.0          OPTION OFF
XDB            Oracle XML Database                      19.0.0.0.0          VALID

Tried to recompile all objects with “@?/rdbms/admin/utlrp.sql” and it didn’t help.

Tried to manually compile a few invalid objects and got the same ORA-29534 error.

SQL> alter java class "oracle/jms/WebLogicHelper" resolve;

Warning: Java altered with compilation errors.

SQL> show error;
Errors for JAVA CLASS "oracle/jms/WebLogicHelper":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      ORA-29534: referenced object SYS.oracle/jms/AQjmsOracleDebug
         could not be resolved

SQL> alter java class "oracle/AQ/AQOracleAdmin" resolve;

Warning: Java altered with compilation errors.

SQL> show error;
Errors for JAVA CLASS "oracle/AQ/AQOracleAdmin":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      ORA-29534: referenced object SYS.oracle/AQ/AQOracleSession could
         not be resolved

The view dba_errors had 131 errors which were all about them.

SQL> select name, type, text, ATTRIBUTE from dba_errors where owner='SYS';

NAME                                                         TYPE                TEXT                                                                                                 ATTRIBUTE
------------------------------------------------------------ ------------------- ---------------------------------------------------------------------------------------------------- ---------
oracle/jms/AQjmsInterOp$VersionParameter                     JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsInterOp could not be resolved                       ERROR
oracle/jms/AQjmsExceptionListener                            JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsOracleDebug could not be resolved                   ERROR
oracle/jms/AQjmsConnectionMetaData                           JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsMessage could not be resolved                       ERROR
oracle/jms/AQjmsListenerWorker                               JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsConsumer could not be resolved                      ERROR
oracle/jms/AQjmsListenerWorker                               JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsSession could not be resolved                       ERROR
oracle/jms/AQjmsListenerWorker                               JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsConnection could not be resolved                    ERROR
oracle/jms/AQjmsExceptionListener$1                          JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsExceptionListener could not be resolved             ERROR
oracle/jms/AQjmsRecipients                                   JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsAgent could not be resolved                         ERROR
oracle/jms/AQjmsMessageProperty                              JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsRecipients could not be resolved                    ERROR
oracle/jms/AQjmsMessageProperty                              JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsAgent could not be resolved                         ERROR
oracle/jms/AQjmsParser                                       JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsConstants could not be resolved                     ERROR
oracle/jms/AQjmsParser                                       JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsOracleDebug could not be resolved                   ERROR
oracle/jms/ParseException                                    JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsUtil could not be resolved                          ERROR
oracle/jms/AQjmsDeqSel                                       JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsOracleDebug could not be resolved                   ERROR
.
.
.
oracle/jms/AQjmsConstants                                    JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/WebLogicHelper could not be resolved                     ERROR
oracle/jms/AQjmsOracleDebug                                  JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsUtil could not be resolved                          ERROR
oracle/jms/WebLogicHelper                                    JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsOracleDebug could not be resolved                   ERROR
oracle/jms/SelectorToRule                                    JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsParser could not be resolved                        ERROR
oracle/jms/AQjmsMessageHeaderExtRef                          JAVA CLASS          ORA-29534: referenced object SYS.oracle/jms/AQjmsMessageHeaderExt could not be resolved              ERROR

131 rows selected.

Because the invalid objects were about AQ and jms, I tried to use “@$ORACLE_HOME/rdbms/admin/initjms.sql” to load AQ/JMS jar files into the database. But it failed with another ORA-29532 error:

SQL> @$ORACLE_HOME/rdbms/admin/initjms.sql

Session altered.


Call completed.

call sys.dbms_java.loadjava('-v -f -r -s -g PUBLIC rdbms/jlib/aqapi.jar')
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.server.tools.loadjava.ToolsError:
Error during loadjava: Failures occurred during processing.
Check trace file for details


Session altered.

Tried to use dbms_java.loadjava without verify (the option noverify) but still failed.

[oracle@joedb ~]$ ls -lrt /opt/oracle/190000/rdbms/jlib/aqapi.jar
-rw-r--r--. 1 oracle oinstall 615206 Feb 17 13:41 /opt/oracle/190000/rdbms/jlib/aqapi.jar
[oracle@joedb ~]$ ls -lrt /opt/oracle/190000/rdbms/jlib/jmscommon.jar
-rw-r--r--. 1 oracle oinstall 25998 Apr 16  2019 /opt/oracle/190000/rdbms/jlib/jmscommon.jar

SQL> call sys.dbms_java.loadjava('-noverify -v -f -r -s -g public rdbms/jlib/jmscommon.jar');

Call completed.

SQL> call sys.dbms_java.loadjava('-noverify -v -f -r -s -g public rdbms/jlib/aqapi.jar');

call sys.dbms_java.loadjava('-noverify -v -f -r -s -g public rdbms/jlib/aqapi.jar')
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.server.tools.loadjava.ToolsError:
Error during loadjava: Failures occurred during processing.
Check trace file for details

Based on the error ORA-29532 and after compared another good system, I decided to get Oracle XDK installed first because classes from jar files imported via dbms_java.loadjava are dependent on a valid installation of:

  • Oracle JavaVM
  • Oracle XDK
  • Oracle XDB

Login SQLPlus as sysdba and run:

@?/xdk/admin/initxml.sql
@?/rdbms/admin/catnojav.sql
@?/rdbms/admin/catjava.sql
@?/rdbms/admin/utlrp.sql
  1. initxml.sql — initialize (load) XML components in JServer which creates Oracle XDK component.
  2. catnojava.sql — remove the RDBMS Java classes and system triggers created by the catjava.sql script.
  3. catjava.sql — create Java classes for RDBMS features.
  4. utlrp.sql — recompile invalid objects.

After that, I recreated data dictionary views and PL/SQL packages and recompiled all objects again:

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql

All invalid objects were gone at this point and all 8 components in dba_registry are valid.

SQL> select comp_id, comp_name, version, status from dba_registry order by 1


COMP_ID                        COMP_NAME                                                    VERSION                        STATUS
------------------------------ ------------------------------------------------------------ ------------------------------ --------------------
CATALOG                        Oracle Database Catalog Views                                19.0.0.0.0                     VALID
CATJAVA                        Oracle Database Java Packages                                19.0.0.0.0                     VALID
CATPROC                        Oracle Database Packages and Types                           19.0.0.0.0                     VALID
JAVAVM                         JServer JAVA Virtual Machine                                 19.0.0.0.0                     VALID
OWM                            Oracle Workspace Manager                                     19.0.0.0.0                     VALID
RAC                            Oracle Real Application Clusters                             19.0.0.0.0                     OPTION OFF
XDB                            Oracle XML Database                                          19.0.0.0.0                     VALID
XML                            Oracle XDK                                                   19.0.0.0.0                     VALID

8 rows selected.

Update on 2021.09:

I saw another 18c system with both CATJAVA and JAVAVM invalid, when tried to run @?/rdbms/admin/catnojav.sql and got the error:

ERROR at line 1:
ORA-20000: JServer is not operational in the database; JServer is required to
remove CATJAVA from the database.
ORA-06512: at line 7

Followed Doc ID 757771.1 and recompile after marking them VALID in the registry:

sqlplus / as sysdba
execute sys.dbms_registry.loaded('JAVAVM');
execute sys.dbms_registry.loaded('CATJAVA');
execute sys.dbms_registry.valid('JAVAVM');
execute sys.dbms_registry.valid('CATJAVA');
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql

Still got JAVAVM with status INVALID. Then followed the option 1 from Doc ID 2314363.1

SQL> alter system set java_jit_enabled = FALSE;
SQL> alter system set "_system_trig_enabled"=FALSE;

-- Keep a Note of original JOB_QUEUE_PROCESSES value before this
SQL> alter system set JOB_QUEUE_PROCESSES=0;

SQL> create or replace java system
/

SQL> alter system set java_jit_enabled = true;
SQL> alter system set "_system_trig_enabled"=TRUE;
SQL> alter system set JOB_QUEUE_PROCESSES=<original value>;
SQL> @?/rdbms/admin/utlrp.sql

All components are valid and no more invalid objects afterwards.

References:

  1. How to Debug and Fix DBMS_JAVA.LOADJAVA Related Problems during Install/Upgrade of Oracle Multimedia/interMedia (Doc ID 1438702.1)
  2. Java Classes Invalid after Running initjms.sql to Load AQ and OJMS Jar Files into the Database (Doc ID 259467.1)
  3. Loadjava Errors During interMedia Installation (Doc ID 432680.1)
  4. Oracle Database Java Packages became invalid after Database upgrade (Doc ID 2634964.1)
  5. Safe repair/reinstall of the JVM Component in 11.2 and up (Doc ID 2314363.1)
  6. Script to Check the Status or State of the JVM within the Database (Doc ID 456949.1)
  7. How to Check or Verify if the Oracle JVM is Installed in the Database (Doc ID 397770.1)
  8. How to Install, Remove, Reload, Validate and Repair the JVM Component in an Oracle Database (Doc ID 2149019.1)
  9. Repairing/Reinstalling JVM To A Multitenant Database (CDB and all PDBs) (Doc ID 2262919.1)
  10. Oracle Database Java Packages (CATJAVA) Option Missing from DBA_REGISTRY (Doc ID 551411.1)
  11. How to Reload the JVM in 12.1.0.x (Doc ID 1612279.1)
  12. The Catnojav.sql Script Fails With Ora-20000 Error Indicating JServer Is Not Operational (Doc ID 757771.1)
  13. Script to Check the Status or State of the JVM within a Multi-tenant Database (Doc ID 2347527.1)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s