database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
ㆍLDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
LDAP Q&A 1783 게시물 읽기
No. 1783
java object 를 ldap에 저장할때의 에러...
작성자
남수진
작성일
2003-05-22 15:56
조회수
5,782

JNDI 로 ldap 에 관한 예제 소스를 테스트중 아래와 같은 에러는 만났습니다. 도움 부탁드립니다.

 

Adding 28420 to directory...

javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error code 17 - javaSerializedData: attribute type undefined]; remaining name 'cn=myRandomInt'

 

 

위와 같은 에러는 왜 나오는 건가요?

 

소스는 다음과 같습니다.

**************************************************************

/*

TestLDAP.java -- basic JNDI application used for

testing adding/retrieving objects from the server.

*/

 

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.naming.NamingException;

import javax.naming.NameAlreadyBoundException;

import javax.naming.directory.*;

import java.util.*;

 

public class TestLDAP {

final static String ldapServerName = "localhost";

final static String rootdn = "cn=Manager, o=JNDITutorial";

final static String rootpass = "secret";

final static String rootContext = "o=JNDITutorial";

 

public static void main( String[] args ) {

// set up environment to access the server

 

Properties env = new Properties();

 

env.put( Context.INITIAL_CONTEXT_FACTORY,

"com.sun.jndi.ldap.LdapCtxFactory" );

env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName + "/" + rootContext );

env.put( Context.SECURITY_PRINCIPAL, rootdn );

env.put( Context.SECURITY_CREDENTIALS, rootpass );

 

try {

// obtain initial directory context using the environment

DirContext ctx = new InitialDirContext( env );

 

// create some random number to add to the directory

Integer i = new Integer( 28420 );

 

System.out.println( "Adding " + i + " to directory..." );

ctx.bind( "cn=myRandomInt", i );

 

i = new Integer( 98765 );

System.out.println( "i is now: " + i );

 

i = (Integer) ctx.lookup( "cn=myRandomInt" );

System.out.println( "Retrieved i from directory with value: " + i );

} catch ( NameAlreadyBoundException nabe ) {

System.err.println( "value has already been bound!" );

} catch ( Exception e ) {

System.err.println( e );

}

}

}

 

// end TestLDAP.java

**************************************************************

 

이것은 http://www.cris.com/~adhawan/tutorial/ 에 나오는 예제를 실행하면서 나온것입니다.

 

 

참고로, 저의 slapd.conf는 다음과 같습니다.

 

include /usr/local/etc/openldap/schema/core.schema

include /usr/local/etc/openldap/schema/cosine.schema

include /usr/local/etc/openldap/schema/java.schema

include /usr/local/etc/openldap/schema/inetorgperson.schema

 

pidfile /usr/local/var/slapd.pid

argsfile /usr/local/var/slapd.args

 

#######################################################################

# ldbm database definitions

#######################################################################

 

database ldbm

suffix "o=JNDITutorial"

#suffix "o=jndiTest"

#suffix "o=My Organization Name,c=US"

rootdn "cn=Manager,o=JNDITutorial"

#rootdn "cn=Manager,o=jndiTest"

#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 accessible by the slapd/tools. Mode 700 recommended.

directory /usr/local/var/openldap-ldbm

schemacheck off

# Indices to maintain

index objectClass eq

 

감사합니다.

이 글에 대한 댓글이 총 3건 있습니다.

include /usr/local/etc/openldap/schema/core.schema

include /usr/local/etc/openldap/schema/cosine.schema

include /usr/local/etc/openldap/schema/java.schema

include /usr/local/etc/openldap/schema/inetorgperson.schema

 

위의 스키마에 다음과 같은 ObjectClass가 있는지 확인을 하기 바랍니다.

 

javaObject

javaContainer

javaSerializedObject

가 있는지 확인해보기 바라고 있다면 없다면 이 Objectclass가 정의 되어 있는 Schema를 include를 해 보시고 다시 내용을 올려주세요..

송상준님이 2003-05-22 17:52에 작성한 댓글입니다.

javaObject

javaContainer

javaSerializedObject

 

위의 ObjectClass 들은 모두 /usr/local/etc/openldap/schema/java.schema 에 있는 것을 확인했으며,

저의 slapd.conf 에서 보듯이 그 스키마 파일을 include 되어 있습니다.

답변 감사합니다.

남수진님이 2003-05-22 18:09에 작성한 댓글입니다.

흠..음...

보이는 에러 메세지는 LDAP 스키마에 Attribute "cn"이 정의가 되어있지 않다는 것 같습니다.

스키마 파일에 "cn"이 정의 되어있는 지 확인하시고 다시 시도해보세요. 소스는 문제 없는것 처럼 보입니다.

jack(swardseven)님이 2003-05-22 18:15에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
1788송상준님의 LDAP도서 언제 나오나여? [1]
이동수
2003-06-04
5424
1787backend db 관련질문요...
김연수
2003-06-04
5018
1785LDAP으로 유저의 계정관리 [1]
뱅기
2003-05-31
5425
1783java object 를 ldap에 저장할때의 에러... [3]
남수진
2003-05-22
5782
1782아래 종합 답변입니다. [1]
송상준
2003-05-22
5116
1781[질문입니다]LDAP 를 관계형 테이블로 매핑하는것에 대해...
이도곤
2003-05-21
5419
1780[질문] 중복된 값을 갖는 엔트리 찾기
김동수
2003-05-21
5913
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.030초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다