에러 메시지를 보니까
binding 은 성공했는데, lookup 과정에서 에러가 난듯 합니다
lookup할때 rdn 말고 dn을 사용해서 해보세요
"cn=Button" 말고, "cn=Button,ou=java,o=test" 처럼요
아, 그 소스를 한번 더 돌리시면,
얼레디 이그지스트 익셉션도 나겠군요 ^^
>>곰 님께서 쓰시길<<
:: 지난번..objectclass에 대한 만복님 답변이 도움이 많이 되었습니다..^^
::
:: 결국 전 ldap에 java object를 넣을려고 했는데요.
:: conf화일에...java.schema인가.하여튼 고놈을 include했고요..
::
:: java jndi tutorial에 나오는 예를 실행했는데...
:: 잘 안되네요.. ldap에서 이 object를 받아 들이지 않는거 같은데..
::
:: import javax.naming.*;
:: import java.util.Hashtable;
:: import java.awt.Button;
::
:: /**
:: * Demonstrates how to bind a Serializable object to a directory.
:: * (Use Unbind to remove binding.)
:: *
:: * usage: java SerObj
:: */
::
:: class SerObj {
:: public static void main(String[] args) {
::
:: // Set up environment for creating initial context
:: Hashtable env = new Hashtable(11);
:: env.put(Context.INITIAL_CONTEXT_FACTORY,
:: "com.sun.jndi.ldap.LdapCtxFactory");
:: env.put(Context.PROVIDER_URL, "ldap://localhost:389");
::
:: try {
:: // Create the initial context
:: Context ctx = new InitialContext(env);
::
:: // Create object to be bound
:: Button b = new Button("Push me");
::
:: // Perform bind
:: ctx.bind("cn=Button", b);
::
:: // Check that it is bound
:: Button b2 = (Button)ctx.lookup("cn=Button");
:: System.out.println(b2);
::
:: // Close the context when we're done
:: ctx.close();
:: } catch (NamingException e) {
:: System.out.println("Operation failed: " + e);
:: }
:: }
:: }
::
:: 를 실행하면...
:: Operation failed: javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; re
:: maining name 'cn=Button' Process Exit...
::
:: 라고 나오는군요....no such object라...
:: 참고로...제..slapd.conf는요..
::
:: # $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.4 2000/08/26 17:06:18 kurt Exp $
:: #
:: # See slapd.conf(5) for details on configuration options.
:: # This file should NOT be world readable.
:: #
:: include schema/core.schema
:: include schema/java.schema
::
:: # Define global ACLs to disable default read access.
::
:: # Do not enable referrals until AFTER you have a working directory
:: # service AND an understanding of referrals.
:: #referral ldap://root.openldap.org
::
:: pidfile slapd.pid
:: argsfile slapd.args
::
:: # Load dynamic backend modules:
:: # modulepath %MODULEDIR%
:: # moduleload back_ldap.la
:: # moduleload back_ldbm.la
:: # moduleload back_passwd.la
:: # moduleload back_shell.la
::
:: #######################################################################
:: # ldbm database definitions
:: #######################################################################
::
:: database ldbm
:: suffix "dc=my-domain, dc=com"
:: #suffix "o=My Organization Name, c=US"
:: rootdn "cn=Manager, dc=my-domain, dc=com"
:: #rootdn "cn=Manager, o=My Organization Name, c=US"
:: # Cleartext passwords, especially for the rootdn, should
:: # be avoid. See slappasswd(8) and slapd.conf(5) for details.
:: # Use of strong authentication encouraged.
:: rootpw secret
:: # The database directory MUST exist prior to running slapd AND
:: # should only be accessable by the slapd/tools. Mode 700 recommended.
:: directory %LOCALSTATEDIR%/openldap-ldbm
:: # Indices to maintain
:: index objectClass eq
::
:: 입니다...
::
:: 질문이 넘 기초적인거 같은데...^^ 부탁드립니다.
|