Two Laptop Bag*
The moose likes Oracle/OAS and the fly likes runnable jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "runnable jar" Watch "runnable jar" New topic
Author

runnable jar

Sagar Deshmukh
Ranch Hand

Joined: Dec 16, 2011
Posts: 37
i have created a RunnableJar(Jar contain another third party jar like iText ,java class, etc etc ) and i have upload that RunnableJar.jar in oracle database using loadjava
in that jar i have main class GetOffer in that i have one method and the use of this method is to create multiple pdf according to user selection and concat them.
Now i have created Stored procedure


and i have called this stored procedure using following call statement



while Calling the procedure we are getting the below error.

SQL> VARIABLE myString VARCHAR2(20);
SQL> CALL getOffer("XYZ") INTO :myString
2 ;
CALL getOffer("Any String") INTO :myString
*
ERROR at line 1:
ORA-06576: not a valid function or procedure name

Guys how to solve this problem.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

What are you trying to do? It looks like you want to use SQL*Plus variables - are you just testing the thing or are you trying to create a script to be run later?

If it's the former, just use If it's the latter, I can only offer the documentation -- I'm not proficient with variables in SQL*Plus myself.

... and welcome to the ranch!
Sagar Deshmukh
Ranch Hand

Joined: Dec 16, 2011
Posts: 37
Thnaks for your reply
I tried this but i m getting following error


i uploaded jar using following command
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

Is the GetOffer class declared in any package?
Sagar Deshmukh
Ranch Hand

Joined: Dec 16, 2011
Posts: 37
No,
Structure

and i have export the jar In Runnable Jar
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

I guess the problem might be caused by the nested jars. I suppose that the JVM in Oracle cannot find the libraries, which in turn causes errors while loading the GetOffer class, which is then reported as nonexistent.

My advice would be to try to load (using loadjava) all jars individually. Perhaps there are some logs in Oracle where the JVM messages could be found - to verify or disprove my supposition.
Sagar Deshmukh
Ranch Hand

Joined: Dec 16, 2011
Posts: 37
Yes you are right but i m running this program in eclipse and all this jar are reference libraries and this program work fine outside oracle.
But if we load all jar separately then i don't think it will work
Because if i write this GetOffer.java code in notepad and put all jar in same folder and run this using cmd then its give a lots of error.
So how to do that ...
Really confused

Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

As far as running the application from command line is concerned: putting all jars in a single directory is not enough, you need to add every single jar to the classpath. Then you can run it without bundling all jars together.

However, Oracle's JVM uses different rules to locate classes. I'm really no expert on this, but I believe it should be possible to get it right from the documentation.

Specifically:
Oracle wrote:All Java classes contain references to other classes. A conventional JVM searches for classes in the directories, ZIP files, and JAR files named in the CLASSPATH. In contrast, Oracle JVM searches schemas for class schema objects. Each class in the database has a resolver specification, which is Oracle Database counterpart to CLASSPATH. For example, the resolver specification of a class, alpha, lists the schemas to search for classes that alpha uses. Notice that resolver specifications are per-class, whereas in a classic JVM, CLASSPATH is global to all classes.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: runnable jar
 
Similar Threads
getting the resultset of a stored procedure?
Diff between Java Stored Procedure and Oracle Stored Procedure
Executing sqlj/java objects in oracle
Error while calling java stored procedure in oracle database
java stored procedure problems