Sample Header Ad - 728x90

How to drop invalid Java classes from Oracle?

2 votes
1 answer
9285 views
I tried to load some jars into my database, but I think I messed up something, because I tried as DBA and then with some oracle user... This was my first command: call dbms_java.loadjava('-genmissing -jarasresource -v -force -grant MYSCHEMA ./some-jar-file.jar'); and then this: call dbms_java.loadjava('-genmissing -v -force -grant MYSCHEMA ./some-jar-file.jar'); I think I also tried with and without MYSCHEMA, because my Java source had alway some errors regarding to this jars. My problem is, that right now I have more than 1500 invalid Java classes and I don't know how to clean this mess up: SELECT * FROM user_objects WHERE /*object_type like '%JAVA%' AND */status = 'INVALID' I tried with this trick: SET HEADING OFF SET FEEDBACK OFF SET ECHO OFF; SPOOL delete-java-class.sql; select 'drop java class "'||object_name||'";' from user_objects where object_type like '%JAVA%' AND status = 'INVALID'; SPOOL OFF; SET HEADING OFF SET FEEDBACK OFF SET ECHO OFF; SPOOL compile-java-class.sql; select 'alter java class "'||object_name||'" resolve;' from user_objects where object_type like '%JAVA%' AND status = 'INVALID'; SPOOL OFF; But the drop script wasn't able to drop these classes (approx. 5 of 1500 could be deleted), I got this error: ora-29537: class or resource cannot be created or dropped directly The recompile script was also not able to resolve the issue, but it was able to reduce the invalid count to 800. Can someone give me some advice? :) Thank you.
Asked by VORiAND (163 rep)
Sep 4, 2015, 02:21 PM
Last activity: Mar 11, 2025, 11:05 AM