| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> JNDI Failure - OutOfMemoryError
Has anyone seen the problem below -
When I first started trying to do this I was getting failures to instantiate LDAPCtxFactory errors. I resolved this by NOT loading the jndi.jar, ldap.jar, and providerutil.jar classes to my schema, but relying on the ones already in the Oracle JServer.
I have been given JAVASYSPRIV and have also tried using dbms_java.grant_permission for the setFactory java.lang.RuntimePermission and granting the java.net.SocketPermission for connect and resolve to my explicit ldap url.
I'm really stumped.
Here is the Java Code
package com.cst.portal.security;
import javax.naming.*;
import javax.naming.directory.*;
import java.util.*;
public class LDAPTest {
public static void main (String[] args) {
System.out.println(getInitialDirContext());
}
public static String getInitialDirContext () {
String result = "";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,
"ldap://myserver.mycompany.com:389");
try {
// Where the code dies
DirContext ctx = new InitialDirContext(env);
return "SUCCESS";
}
catch (Exception e) {
System.out.println (e.getMessage());
return "FAILURE - " + e.getMessage();
}
}
}
This gets published to the database as the following package
PACKAGE EXTAUTH AUTHID CURRENT_USER AS FUNCTION GETINITIALDIRCONTEXT RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'com.cst.portal.security.LDAPTest.getInitialDirContext() return java.lang.String';
END EXTAUTH;
When the Java Stored procedure is called with this PL/SQL
DECLARE result VARCHAR2(255);
BEGIN dbms_java.SET_OUTPUT(2000);
result := EXTAUTH.getInitialDirContext();
dbms_output.put_line(result);
END;
This is the result on dbms_out
java.lang.OutOfMemoryError
at java.lang.Thread.start(Thread.java)
at com.sun.jndi.ldap.Connection.<init>(Connection.java:170)
at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:85)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2251)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:210)
at
com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:83)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java)
at javax.naming.InitialContext.init(InitialContext.java)
at javax.naming.InitialContext.<init>(InitialContext.java)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java)
at com.cst.portal.security.LDAPTest.getInitialDirContext(LDAPTest.java:20)
Richard Williams
CTO Computer Systems Technology, Inc.
Huntsville, AL
Voice: 256-890-3076
Email: rwilliam_at_cst-hsv.com Received on Thu Feb 21 2002 - 17:07:44 CST
![]() |
![]() |