ClassNotFound Exception that is part of the rt.jar in 1.3.1 oracle jvm.

From: John Smith <javapro6_at_hotmail.com>
Date: 14 Mar 2003 09:19:49 -0800
Message-ID: <77ff5fa2.0303140919.49f7b0e5_at_posting.google.com>


Hello All,

We have been having a very odd problem with one of our Java Stored Procedures and the techies at Oracle don't seem to know what the issue is. Sample code and error are posted belows as well as more information:


  • ERROR ****************************

Error: javax.naming.NoInitialContextException: Cannot instantiate class:
com.sun.jndi.rmi.registry.RegistryContextFactory [Root exception is java.lang.ClassNotFoundException:
com/sun/jndi/rmi/registry/RegistryContextFactory] PL/SQL procedure successfully completed.


  • CODE SAMPLE **********************

//EchoClient.java
import java.rmi.*;
import javax.naming.*;
public class EchoClient {
public static void main(String [] args) { try {
System.out.println("Connecting to echo server..."); Context ctxt = new InitialContext();
Echo e = (Echo) ctxt.lookup("ECHO");
String result = e.echo("Hello");
System.out.println("Echo returned " + result);
}

catch (Exception e) {
e.printStackTrace();
}
}
}


When this code is run outside of oracle in a regular java jvm 1.3.1 and higher it works just fine. However, when we wrap it with an SQL wrapper and use it in oracle we get the exception from above. The class is just doing a simple RMI call, northing more, nothing less. The class that is in question in the error com/sun/jndi/rmi/registry/RegistryContextFactory resides in the rt.jar (RunTime) with version 1.3.1 and higher. Now it is my understanding that everyclass in rt.jar is part of the standard JVM and therefore should not be excluded.

However, after I logged into the database as "/ as sysdba" and did the following select statement.

select dbms_java.longname(object_name) from user_objects where object_type like
'%JAVA%' and dbms_java.longname(object_name) like '%com/sun/jndi%'

The results are as follows....
SQL> /
DBMS_JAVA.LONGNAME(OBJECT_NAME)


com/sun/jndi/cosnaming/ExceptionMapper$2
com/sun/jndi/cosnaming/ExceptionMapper$1
com/sun/jndi/cosnaming/jndiprovider.properties
com/sun/jndi/toolkit/url/UrlUtil
com/sun/jndi/cosnaming/RemoteToCorba
com/sun/jndi/cosnaming/CNBindingEnumeration
com/sun/jndi/cosnaming/CNNameParser$CNCompoundName
com/sun/jndi/cosnaming/CNNameParser
com/sun/jndi/cosnaming/IiopUrl$Address
com/sun/jndi/toolkit/corba/CorbaUtils
com/sun/jndi/cosnaming/CNCtxFactory
com/sun/jndi/cosnaming/ExceptionMapper
com/sun/jndi/cosnaming/CNCtx
com/sun/jndi/cosnaming/IiopUrl

14 rows selected.

We looked in rt.jar again and went to the com/sun/jndi/cosnaming/ directory in the jar. All the files that came up in the query exist in the JAR.

So... basically we have a situation where some of the classes that are in the regular JVM are left out of oracle's JVM. I say some because if the one class we are looking for is not there, then there must be other missing classes as well.

We are running Oracle 9.2.0.2 can anyone help us with this problem or give some kind of tips?

Regards,

John Received on Fri Mar 14 2003 - 18:19:49 CET

Original text of this message