ORA-29540: class does not exist - - Java - JDBC (Archived)

urgently needed.... I am trying to call Java Stored Procedure using JDBC. I loaded the class and created the call spec and all the objects are created succesfully ( i checked the status in User_objects table). But when I call the function, it gives me ORA-29540 error saying the class does not exists. One thing that I noticed is, when I load the java class file from command line (specified below), it creates the object with some number in front of it, e.g when I query the User_object table i get.. loadjava -resolve -force -user test/test#testDB /tempDir/TestProcedures.class SQL> select object_name,object_type,status from user_objects where object_type LIKE 'JAVA%'; OBJECT_NAME -------------------------------------------------------------------------------- OBJECT_TYPE STATUS ------------------ ------- /61e76809_TestProcedures JAVA CLASS VALID So when I execute I get this error ORA-29540: class TestProcedures does not exist Not sure if that weird String in front is causing the error. Please suggest what else could be wrong. Thanks a lot in advance for help.

386037,
Try the following query:
select
   DBMS_JAVA.LONGNAME(OBJECT_NAME) as OBJECT_NAME
  ,OBJECT_TYPE
  ,STATUS
from
   USER_OBJECTS
where
   OBJECT_TYPE like 'JAVA%'Good Luck,
Avi.

Thanks Avi for the Query.
Actually the weird string it was adding to object name was for the package.
While creating the call spec I was just specifying the class name instead of the whole package. I added the package and created the call spec again and it worked.
FYI - I found in documentation about the digest table that gives you the full name of the object created which is Java$class$md5$table.
Thanks for your help. 

good job!

Related

PROCEDURE WITH CURSOR ERROR

I wanted to have a cursor in my procedure having results from different tables and different databases. I successfully created the query and compiled it using the procedure builder. However, when i was about to create it as stored procedure in iSQLplus, it displayed a warning. It says "Procedure created wuth compilation error." The first error is "PLS-00341: declaration of cursor 'SUBJ_CUR' is incomplete or malformed"
Here's a piece of my code:
--------------------------------
PROCEDURE assess(STUD_ID VARCHAR2, STUD_YEAR NUMBER, STUD_TYPE CHAR) IS
CURSOR subj_cur IS
SELECT e.student_id, s.subject_id, s.subj_code, s.subject_title, s.units, s.pay_units,
d.department_name, s.tuition_fee_type, s.lab_fee_type, f.year, f.amount
FROM regist.enrol e, regist.offering o, regist.subject s,
fee_details f, regist.student st, regist.department d
WHERE (e.student_id = STUD_ID) AND (e.offering_id = o.offering_id) AND
(o.subject_id = s.subject_id) AND (f.fee_no = s.tuition_fee_type) AND
(st.student_id=e.student_id) AND ((f.year = STUD_YEAR) OR (f.year=0)) AND
(s.department_id = d.department_id);
-----------------------------
regist and system are databases.
Can anyone tell me where did I go wrong?
I resorted though in creating views, however I still received an error. It says, "Insufficient privileges"
Help me please..... I really need it badly.. 
First of all, I've no experience with iSQLplus. I'm just wondering in which database the table fee_details is: system or regist? You didn't prefix the table.

ORA-29540: class Hello does not exist

Hi,
i have loaded java file into oracle.
D:\File>loadjava -user SAMPLE/SAMPLE -oci8 Hello.java
after that i amtring to acess that function. i have created hello_there1. the class name is Hello nad i have one method sayit() with one String parameter. the program is stored in the " D:\File ".
SQL> CREATE FUNCTION hello_there1 (to_whom IN VARCHAR2)
2 RETURN VARCHAR2
3 AS LANGUAGE JAVA
4 NAME 'Hello.sayIt
5 (java.lang.String) return java.lang.String';
6 /
Function created.
SQL> BEGIN
2 DBMS_OUTPUT.PUT_LINE(hello_there1('world'));
3 END;
4 /
BEGIN
*
ERROR at line 1:
ORA-29540: class Hello does not exist
ORA-06512: at "DEMO.HELLO_THERE1", line 0
ORA-06512: at line 2
But i am getting above error when pass the value.it is saying class Hello does not exit. Is there any query to find the what are programs are loaded into particular user?
any help in this one....
Thanks,
kk 
Duplicate post:
Error at calling loaded java program
K,
Looks to me like you load the java class into SAMPLE schema, but the PL/SQL wrapper is in DEMO schema.
Is this correct?
You are loading java source code into the database.
The source code needs to be compiled.
Have you checked that the compiled class exists in the database, and is valid?
Try the following query:
select
  OWNER
,DBMS_JAVA.LONGNAME(OBJECT_NAME) as OBJECT_NAME
,STATUS
from
  ALL_OBJECTS
where
  OBJECT_TYPE like 'JAVA%'Good Luck,
Avi. 
Hi,
yes, you are correct. i schema is different. now is have changed that one.
i have tried that query. but the status is invalid. what is the wrong with that one?
could you tell me?
SQL> select OWNER ,DBMS_JAVA.LONGNAME(OBJECT_NAME) as OBJECT_NAME ,STATUS from
ALL_OBJECTS where OBJECT_TYPE like 'JAVA%' and OWNER='SAMPLE';
OWNER OBJECT_NAME STATUS
------------------------------ ------------------------------ -------
SAMPLE Hello INVALID 
K,
Did you get an error when you loaded the java source code file into the database?
If yes, perhaps you can post the error message you got?
Good Luck,
Avi. 
Hi,
No, i did not get any error. i have loaded it with out any error.
D:\logfilemonitor1>loadjava -user SAMPLE/SAMPLE#orcl -oci8 Hello.class
D:\logfilemonitor1>
SQL> select OWNER ,DBMS_JAVA.LONGNAME(OBJECT_NAME) as OBJECT_NAME ,STATUS from
ALL_OBJECTS where OBJECT_TYPE like 'JAVA%' and OWNER='SAMPLE';
OWNER OBJECT_NAME STATUS
------------------------------ ------------------------------ -------
SAMPLE Hello INVALID
Regards,
kk 
Hi,
i have tried some other programs also. for that program status also "INVALID". But i did not get any error when i use loadjava command. what do i want to do now?
regards,
kk 
K,
Bit difficult to figure out your problem when you are being inconsistent.
From your first post:
D:\File>loadjava -user SAMPLE/SAMPLE -oci8 Hello.javaFrom your third post:
D:\logfilemonitor1>loadjava -user SAMPLE/SAMPLE#orcl -oci8 Hello.classWhat Oracle database version are you using?
What java version are you using?
Are you trying to load the java source code file or the compiled class file?
Are you trying to load the class from the same computer as the database server is running on, or from a remote computer?
Try using the "-verbose" option of "loadjava".
Perhaps it will provide some helpful information.
Good Luck,
Avi. 
Hi,
Sorry for the inconvenience. because i have tried from different folder and user. thrid post, i have posted in from different folder.
Now i haved mentioned steps what i have followed.
D:\logfilemonitor1>loadjava -verbose -user SAMPLE/SAMPLE#orcl Hello.class
arguments: '-verbose' '-user' 'SAMPLE/SAMPLE#orcl' 'Hello.class'
creating : class Hello
loading : class Hello
SQL> select DBMS_JAVA.LONGNAME(OBJECT_NAME) as OBJECT_NAME ,STATUS from ALL_OB
JECTS where OBJECT_TYPE like 'JAVA%' and OWNER='SAMPLE';
OBJECT_NAME STATUS
------- -------------
Hello INVALID
then i connected to SAMPLE/SAMPLE . then i excuted following PL/SQL script.
SQL> CREATE FUNCTION hello_there1 (to_whom IN VARCHAR2)
2 RETURN VARCHAR2
3 AS LANGUAGE JAVA
4 NAME 'Hello.sayIt
5 (java.lang.String) return java.lang.String';
6 /
Function created.
SQL> BEGIN
2 DBMS_OUTPUT.PUT_LINE(hello_there1('world'));
3 END;
4 /
BEGIN
*
ERROR at line 1:
ORA-29541: class SAMPLE.Hello could not be resolved
ORA-06512: at "SAMPLE.HELLO_THERE1", line 0
ORA-06512: at line 2
I am getting following error. this is first time i am using loadjava. if i made any mistake informto me.
Thanks,
kk 
K,
I couldn't find the answers to my questions in your reply.
As long as the status of the loaded class is not VALID, you will not be able to invoke your java stored procedure.
You don't need the "-oci8" option because that is the default.
You don't need the "#orcl" if that is the only database instance.
I suggest looking up the documentation for the "loadjava" utility.
Try the "-resolve" flag as well.
Good Luck,
Avi. 
Hi,
thanks a lot... i have solved that problem. i have used -resolve. i got exact result.
Regards,
kk

loadjava is not creating exact class name in user_objects

Hi,
i have loaded java class file using below command .
loadjava -user abc/abc#flex -oci8 -resolve ClientAppletLogin.class
The object is loaded sucessfully and object staus is valid. but the object name in user_objest is different
ex: /5892ca12_ClientAppletLogin
wen i try to call the class with actual class name such as ClientAppletLogin it's throwing an error ORA-29540: class ClientAppletLogin does not exist.
can some pls help me to resolve this issue.
i would appreciate quick response.
Thanks. 
The object_name is the short name of the class. In order to get the full name of the closs try following query
select object_name, DBMS_JAVA.LONGNAME(object_name) from user_objects where object_type like 'JAVA%'
If you are using any tool such as TOAD, then you can login into database, select the schema and select the Java tab to view the full name.
How are you calling the java class from Oracle?

ORA-29534 exception --> loadjava

everytime I'm trying to load the libraries for ejb session beans to the database I get an ORA-29534 exception.
The status of these java classes (that are needed) in the user_objects are INVALID. I don't know what I must do or how I can chanche the status of the java classes. Can anybody help me? 
Are you able to run Java Stored Procedures succesfully in your system.
Log into SQL*Plus as SYS. Issue the following queries:
SQL> SELECT count(*) FROM obj$ WHERE type#=29 AND owner#=0;
COUNT(*)
----------
8535
It should return >= 8000.
SQL> SELECT count(*) FROM obj$ WHERE type#=29 AND owner#=0 AND status != 1;
COUNT(*)
----------
0
Let me know the results of the above and creating of Java SP's.
null 
I've checked out. We can run Java Store Procedures. The results of the sql-statements were exactly like above.
Then we tried to load up the libraries and get the exception ORA-29534 like before. The classpath is correctly set and no errors during the installation. Don't know what to do. We can't deploy to Oracle8i platform (EJB).
One thing we don't understand is the INVALID objects in the database (oracle/jbo/). We don't know how we can change it, too.

Error Loading Jar file.

I am using Java stored procedures in my project.
I am running oracle 9.2.0.4. Part of my program parses an xml using xerces. So I tried to load the dependencies as and when i got unresolved error. However after loading all the dependencies i still couldnt resolve most of xalan files. I get following error.
ORA-29545: badly formed class: at offset 152 of org.apache.xalan.lib.PipeDocument.usePipe expecting a class-org.xml.sax.ContentHandler but encountered a class-org.xml.sax.ContentHandler.
Can anybody help me how to resolve this issue. 
For your information, there are already XML parsers loaded into the database. If you haven't already done so, I suggest running the following query:
select
   DBMS_JAVA.LONGNAME(OBJECT_NAME) as Object_Name
  ,OBJECT_TYPE
  ,OWNER
  ,STATUS
from
   ALL_OBJECTS
where
   upper(DBMS_JAVA.LONGNAME(OBJECT_NAME)) like '%XML%'
and
   OBJECT_TYPE like 'JAVA %'Good Luck,
Avi.

Categories

Resources