Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, prashant.

Asked: June 29, 2000 - 2:14 pm UTC

Last updated: December 17, 2018 - 2:25 am UTC

Version: 8.1.3

Viewed 10K+ times! This question is

You Asked

Hi,
We have default ORACLE8I(8.1.6) server installation.
Following is the JAVA Program.
import java.sql.*;
import java.io.*;
public class DropAny{
public static void object(String object_type,String object_name)
throws SQLException
{
//connect to oracle using JDBC
Connection conn = DriverManager.getConnection("jdbc:defaul
t:connection:");
String sql = "DROP " + object_type +" "+object_name;
try{
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
stmt.close();
}catch (SQLException e)
{System.err.println(e.getMessage()); }
}
}
I am trying to compile and store this DropAny.java program into
ORACLE 8i database by following command.
loadjava -u gullakoa/gullakoa@aenc15 -v -r DropAny.java

It gives me following error.
internal error: unanticipated exception: java.lang.NoClassDefFoundError: oracle/
aurora/sqljdecl/SqljDecl
java.lang.NoClassDefFoundError: oracle/aurora/sqljdecl/SqljDecl
at oracle.aurora.server.tools.loadjava.SourceFileReader.getScanner(Sourc
eFileReader.java:52)
at oracle.aurora.server.tools.loadjava.SourceFileReader.getFirstName(Sou
rceFileReader.java:61)
at oracle.aurora.server.tools.loadjava.LoadJava.noteSource(Compiled Code
)
at oracle.aurora.server.tools.loadjava.LoadJava.processLoadAndCreate(Com
piled Code)
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:11
35)
at oracle.aurora.server.tools.loadjava.LoadJavaMain.run(LoadJavaMain.jav
a:266)
at oracle.aurora.server.tools.loadjava.LoadJavaMain.main(LoadJavaMain.ja
va:57)
resolver :
loadjava: 1 errors


What is wrong here? Any help is appreciated.
Thanks,
Prashant Shah

and Tom said...

It is either (same for NT, just reverse the slashes):

The loadjava command is really just a unix script
(found in $ORACLE_HOME/bin). This script still relies
on using the classes111.zip to run this script and expects
to find classes111.zip in $ORACLE_HOME/jdbc/lib directory..

If classes111.zip isn't found in directory
$ORACLE_HOME/jdbc/lib when the loadjava script in invoked,
then the NoClassDefFoundError exception is raised.

OR (same for unix, reverse the slashes and set an environment variable)

The error message described above occurs because the Windows NT
'loadjava.bat' script is unable to access the 'translator.zip' file while attempting to load the '.java' file to RDBMS.

The 'translator.zip' file can be located in the following client
PC's folder as :

c:\ORACLE_HOME\sqlj\lib\translator.zip


Solution Description
--------------------

To correct this problem, perform the following steps:

1) Go to the ENVIRONMENT PANEL as follows :

START->SETTINGS->CONTROL PANEL->SYSTEM->ENVIRONMENT PANEL

2) Create or update a CLASSPATH variable with the following value:

C:\ORACLE_HOME\sqlj\lib\translator.zip

Note : Replace 'C:\ORACLE_HOME' with your PC's
'DRIVE LETTER:\ORACLE HOME' folder location.

3) Close and open your Command Prompt window to implement the new
CLASSPATH setting.

The 'LOADJAVA' process should work now.


Note: %ORACLE_HOME%\sqlj\lib\translator.zip is not available in Oracle 12c (its desupported after 11)

Rating

  (6 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

philip, July 11, 2004 - 10:30 pm UTC

i am trying to load the XDK 10g into 9.2.0.3 and I get a number of errors regarding referenced objects that cannot be resolved although it seems classes are getting loaded.

extract below :

C:\xdk_nt_10_1_0_2_0_production\bin>Rem ============================= 

C:\xdk_nt_10_1_0_2_0_production\bin>Rem Load the classes 
-----------------------------------------------------------------------
"Loading the XDK libraries"


C:\xdk_nt_10_1_0_2_0_production\bin>if exist C:\xdk_nt_10_1_0_2_0_production\lib\xmlplsql.jar call loadjava -r -v -g public -u steve_xml/steve_xml@rtndev_websphere1 -s C:\xdk_nt_10_1_0_2_0_production\lib\xmlparserv2.jar C:\xdk_nt_10_1_0_2_0_production\lib\xmlplsql.jar C:\xdk_nt_10_1_0_2_0_production\lib\xsu12.jar C:\xdk_nt_10_1_0_2_0_production\lib\xdb.jar 

C:\xdk_nt_10_1_0_2_0_production\bin>if not exist C:\xdk_nt_10_1_0_2_0_production\lib\xmlplsql.jar call loadjava -r -v -g public -u steve_xml/steve_xml@rtndev_websphere1 -s C:\xdk_nt_10_1_0_2_0_production\lib\xmlparserv2.jar C:\xdk_nt_10_1_0_2_0_production\lib\xsu12.jar C:\xdk_nt_10_1_0_2_0_production\lib\xdb.jar 
arguments: '-r' '-v' '-g' 'public' '-u' 'steve_xml/steve_xml@rtndev_websphere1' '-s' 'C:\xdk_nt_10_1_0_2_0_production\lib\xmlparserv2.jar' 'C:\xdk_nt_10_1_0_2_0_production\lib\xsu12.jar' 'C:\xdk_nt_10_1_0_2_0_production\lib\xdb.jar' 
....
creating : class oracle/xml/util/XMLUtil
loading  : class oracle/xml/util/XMLUtil
....
....
resolving: class oracle/xml/util/QxName
errors   : class oracle/xml/util/QxName
    ORA-29534: referenced object STEVE_XML.oracle/xml/util/XMLUtil could not be resolved
synonym  : oracle/xml/util/QxName
granting : execute on class oracle/xml/util/QxNameHash$WeakValue to public
errors   : class oracle/xml/util/QxNameHash$WeakValue
    ORA-29534: referenced object STEVE_XML.oracle/xml/util/QxNameHash could not be resolved
synonym  : oracle/xml/util/QxNameHash$WeakValue
granting : execute on class oracle/xml/util/QxNameHash to public
errors   : class oracle/xml/util/QxNameHash
    ORA-29534: referenced object STEVE_XML.oracle/xml/util/QxName could not be resolved
synonym  : oracle/xml/util/QxNameHash
granting : execute on class oracle/xml/util/StringHashtable$Entry to public
skipping : class oracle/xml/util/StringHashtable$Entry
synonym  : oracle/xml/util/StringHashtable$Entry
granting : execute on class oracle/xml/util/StringHashtable to public
skipping : class oracle/xml/util/StringHashtable
synonym  : oracle/xml/util/StringHashtable
granting : execute on class oracle/xml/util/UnicodeUtil to public
errors   : class oracle/xml/util/UnicodeUtil
    ORA-29521: referenced name oracle/i18n/text/OraNormalizer could not be found
synonym  : oracle/xml/util/UnicodeUtil
granting : execute on class oracle/xml/util/XMLError to public
....
....

also at the end of the script ...

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
"-----------------------------------------------------------------------"
"Testing..."


SQL*Plus: Release 9.2.0.1.0 - Production on Mon Jul 12 11:30:50 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SP2-0310: unable to open file "C:\xdk_nt_10_1_0_2_0_production\xdk\admin\xsutest.sql"
SQL> 


could you possibly help (hopefully enough info)?
regards 

Tom Kyte
July 12, 2004 - 11:12 am UTC

you cannot put 10g functionality into 9i, it'll not work at all. the necessary kernel support just isn't there.

sort of like trying to take a windows/xp system dll and plopping it on win95 and expecting it to work.

XML JAXB ?

steve B, July 12, 2004 - 9:13 pm UTC

I have come across an example that uses :
XML Developer's Kit (XDK) 10g
Oracle9i Database version 9.2.0.2 or later

</code> http://otn.oracle.com/sample_code/tech/xml/jaxb/Readme.html <code>

But I guess the difference is that the XDK 10g is not loaded into Oracle 9.

What I want to to do is read some data out of Oracle 9, format it into XML according to a schema and put the XML onto MQ. I have AQ and the Messaging Gateway set up and I was trying to use the JAXB support in the XDK to generate my XML as a transform as it goes through the Gateway.

I thought the JAXB approach was the way to go as the 9i class generator looks to be superseded by the JAXB method in 10g.

Any thoughts or is there another way I should be generating my XML.

Thanks

Tom Kyte
July 13, 2004 - 12:01 am UTC

9i has a full XDK in it already - what is missing that prevents you from accomplishing this?

steve, July 13, 2004 - 12:36 am UTC

There is a fear of developing under 9i XDK and then having to re write in order to use under 10g , after a "near' future upgrade. The need is to write the parser for the XML to be as portable as possible. If we have to take this out of the database and run elsewhere we can with as little effort as posible. I know generic is not always the answer , however this is seen as requirement.

We have tried loading suns JAXB classes using loadjava with no results (disapointed !). We managed to load 10g XDK into 9i and get working so we could use the JAXB features, however your comment implies not supported - so not an issue.

So i guess, will we loose anything if we use 9i XDK when we upgrade to 10g?

Tom Kyte
July 13, 2004 - 11:21 am UTC

they are upwards compatible.

thanks ....

steve, July 13, 2004 - 9:18 pm UTC

thanks tom, your assistance has been useful on this and other things - i think that yes, 9i XDK would be sufficient for now. However I still have one issue that I cannot figure out , which is , why would I be unable to load suns JAXB classes into my 9i database? When I load it I get masses of errors as below

...
Error while creating class java/nio/charset/CoderResult
ORA-29545: badly formed class: User has attempted to load a class (java.nio.

charset.CoderResult) into a restricted package. Permission can be granted using
dbms_java.grant_permission(<user>, LoadClassInPackage...
....
The following operations failed
class java/nio/Buffer: creation
class java/nio/charset/Charset: creation
class java/nio/CharBuffer: creation
class java/nio/charset/CoderResult: creation
class java/nio/charset/CharsetEncoder: creation
class java/nio/ByteBuffer: creation
exiting : Failures occurred during processing

the classes become unusable/uncompileable in the db.

thanks



Same problem with Oracle 10g

Randiel, June 27, 2012 - 12:27 pm UTC

I have the same problem but my error says: ORA-29521: No se ha encontrado el nombre java/lang/class al que se hace referencia

some idea.

%ORACLE_HOME%\sqlj\lib\translator.zip missing in Oracle 12c

Walter Weinmann, December 16, 2018 - 3:41 am UTC

%ORACLE_HOME%\sqlj\lib\translator.zip is not available in Oracle 12c