I am facing a problem and as far as I have searched, I have not found anything to solve it.
I have to define a setup process using only sql scripts (so command line tool will not be an option here).
A part of the setup is to load java classes in the database.
To do this, on a Windows environnent, I am using the plsql procedure as follows :
exec dbms_java.loadjava('-v ./class/ccj.jar');
considering that my class is located in C:\app\mytool\class\ and that I set the current directory to C:\app\mytool before running sqlplus, this will work (because sqlplus normally uses the current working directory).
But If I am using the same statement on Linux Redhat, considering that my jar file is located into the directory /tmp/app/mytool/class and setting the working directory to /tmp/app/mytool/ before running sqlplus, then I keep getting the error : arguments: '-kprb' '-v' './class/ccp.jar' Error while opening file: ./class/ccp.jar Exception java.io.FileNotFoundException: No such file or directory creating : ./class/ccp.jar The following operations failed
+./class/ccp.jar: opening file+ exiting : Failures occurred during processing Exception in thread "Root Thread" oracle.aurora.server.tools.loadjava.ToolsError: Error during loadjava: Failures occurred during processing. Check trace file for details at oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(LoadJavaMain.java:17
+8)+ at oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(LoadJavaMain.java:11
+3)+ at oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(LoadJavaMain.java:97
+)+ BEGIN dbms_java.loadjava('-v ./class/ccp.jar'); END;
*+ 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 ORA-06512: at "SYS.DBMS_JAVA", line 655 ORA-06512: at line 1
it seems that the working directory is just ignored on Linux because :
exec dbms_java.loadjava('-v /tmp/app/mytool/class/ccj.jar');
will work perfectly.
So to avoid losing time :
1. Yes, I am sure that the file exists.
2. Yes, it is located on the database server.
3. Yes, I am sure that all needed privileges have been granted.
Is there any way to make it consider the working directory?
The tool can be copied anywhere on the file system and the requirement is to avoid user to specify the directory where the tool will be located.
Thank you for your help.
Hi Max: exec dbms_java.loadjava('-v ./class/ccj.jar'); is running in server side mode which means that paths like ./some_dir/ are relative to the ORACLE_HOME.
In your example ./class/ccj.jar is translated to $ORACLE_HOME/class/ccj.jar.
To use ./class/ccj.jar relative to the current directory try using loadjava tool, also you could integrate loadjava tool using Ant .
Best regards, Marcelo.
First thank you for your answer.
I understand better this behaviour better. But not why it is relative to ORACLE_HOME on Linux and relative to cmd working directory on Windows.
Anyway, the proposed solutions are not suitable options for client.
One of the client requirements is that everything should be run from SQL scripts / PL/SQL. So a commandline tool is not suitable. Already thought to Ant, but client rejected that solution too.
I guess that the only alternative will be to set as requirement to use the tool that my the classes should be located in ORACLE_HOME on Linux before running it.
We have a java program that creates image containing text of different fonts & languages. We created a JAR and using loadjava have loaded this jar into the database(11g) and the image gets generated correctly.
When the same JAR is loaded into 10g database, though the image gets generated, all the text in it is displayed as boxes.
What could be the reason?
Why this difference between 10g & 11g??