0

I am trying to re-compile one of the .Java file in Oracle 11g and I am getting the below error:

$ . /dboracle/orabase/product/11.2.0.BTSP8/bin/loadjava -verbose -resolve -synonym -user nm/nm -grant PUBLIC DeviceAttribParserConstants.java
arguments: '-user' 'nm/***' '-verbose' '-resolve' '-synonym' '-grant' 'PUBLIC' ' DeviceAttribParserConstants.java'
creating : source com/bt/nmsloader/model/DeviceAttribParserConstants
loading  : source com/bt/nmsloader/model/DeviceAttribParserConstants
Error while creating source com/bt/nmsloader/model/DeviceAttribParserConstants
    ORA-29542: class com/bt/nmsloader/model/DeviceAttribParserConstants already defined by source DeviceAttribParserConstants/java
ORA-06512: at line 1

The following operations failed
    source com/bt/nmsloader/model/DeviceAttribParserConstants: creation (createFailed)
exiting  : Failures occurred during processing

When I have looked in the ALL_Objects meta-dictionary I did not found JAVA SOURCE but can only see JAVA CLASS for DeviceAttribParserConstants.

Now when I am trying to recompile then I am getting above error and if I am dropping the same JAVA class file then I am getting error as below:

ORA-29537: class or resource cannot be created or dropped directly. 
ORA-06512: at line1
* Cause: An attempt was made to create or drop JAVA class or resources that is a known result from compilation of an existing JAVA Source object.

I am stuck. Can someone help me in resolving this error.

Many thanks in advance.

Regards, Himmy Chauhan

Dmitry Demin
  • 2,006
  • 2
  • 15
  • 18
Himmy
  • 15
  • 6
  • I can't help, but I can comment :). You said: "Can we delete records from Meta Dictionary?" My answer: if you want to destroy your database, go ahead. Otherwise, don't. – Littlefoot Jan 29 '19 at 09:07

1 Answers1

0

Can we delete records from Meta Dictionary

You shouldn't as it is likely to corrupt your database.

Now when I am trying to recompile then I am getting above error and if I am dropping the same JAVA class file then I am getting error as below:

ORA-29537: class or resource cannot be created or dropped directly. 
ORA-06512: at line1
* Cause: An attempt was made to create or drop JAVA class or resources that is a known result from compilation of an existing JAVA Source object.

The loadjava utility has a force option:

-force      Forces files to be loaded, even if they match digest table entries.

So you can try:

loadjava -verbose -force -resolve -synonym -user nm/nm -grant PUBLIC DeviceAttribParserConstants.java

You can also try to drop the existing java object:

SELECT OWNER, OBJECT_NAME
FROM   ALL_OBJECTS
WHERE  OWNER = 'NM'
AND    OBJECT_NAME LIKE '%DeviceAttribParserConstants';

DROP JAVA CLASS NM.<insert_object_name>

and then try using loadjava without the force option.

(You may want to try backing up the existing class file before you drop/overwrite it just in case you need to revert to the prior version.)

MT0
  • 143,790
  • 11
  • 59
  • 117