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 1145 게시물 읽기
No. 1145
Re: JNDI를 이용해 JSP에서 LDAP Entry 추가
작성자
박근오(lastnite)
작성일
2001-10-18 17:02
조회수
7,644

-- 양근우 님이 쓰신 글:

>> 정말 하나도 모르는 상태에서 하려니까 막막합니다. 그래도 여기 여러분들의 글을 읽고 하나씩 하고 있습니다.

>>

>> 리눅스에 Openldap과 Berkley DB를 깔아서 ldapadd 명령어로 사용자를 추가하는 것은 성공했습니다. 이제 JSP 페이지에서 사용자를 LDAP에 추가하는 페이지를 만들어야 하는데 잘 되질 않는군요. 다른 분들의 예제를 봐도 잘 모르겠고요...

>>

>> 제가 쓰는 ldif 파일은

>>

>> ----------------------

>> dn: cn=simpact,dc=kms,dc=kaist,dc=ac,dc=kr

>> objectClass: person

>> objectClass: uidObject

>> sn: Yang

>> cn: GW yang

>> userPassword: simpact

>> uid: simpact

>> ------------------------

>>

>> 와 같고요... 이걸

>>

>> ldapadd -D "cn=Manager,dc=kms,dc=kaist,dc=ac,dc=kr" -w kms123 -f sample3.ldif

>>

>> 이렇게 하면 사용자 추가가 됩니다. 그런데 이걸 다음과 같은 JSP 페이지로 시도를 하면 에러가 납니다.

>>

>> ----------------------------------

>> <%@ page session="true" import="javax.naming.*, javax.naming.directory.*, java.util.*" contentType="text/html; charset=euc-kr"%>

>>

>> <%

>>

>> Hashtable env = new Hashtable(11);

>>

>> env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

>> env.put(Context.PROVIDER_URL, "ldap://isir.kaist.ac.kr:389/");

>> env.put(Context.SECURITY_PRINCIPAL, "cn=Manager,dc=kms,dc=kaist,dc=ac,dc=kr");

>> env.put(Context.SECURITY_CREDENTIALS, "kms123");

>>

>> try {

>> DirContext ctx = new InitialDirContext(env);

>> // out.println("인증에 성공했습니다...");

>>

>>

>> Attributes attrs = new BasicAttributes(true);

>> Attribute objclass = new BasicAttribute("objectclass");

>> Attribute person = new BasicAttribute("person");

>> Attribute uidObject = new BasicAttribute("uidObject");

>>

 

안녕하세요. 몇몇 부분을 수정하였습니다.

그럼 즐거운 하루되세요.

 

 	Attribute objclass = new BasicAttribute("objectclass");
 	Attribute person = new BasicAttribute("person");
 	Attribute uid = new BasicAttribute("uid");
 	Attribute cn = new BasicAttribute("cn");
 	Attribute sn = new BasicAttribute("sn");
 	Attribute passwd = new BasicAttribute("userPassword");

 	objclass.add("person");
 	objclass.add("uidObject");
 
 	sn.add("Yang");
 	cn.add("GW Yang");
 	passwd.add("simpact");
 	uid.add("simpact");
  
 	attrs.put(objclass);
 	attrs.put(sn);
 	attrs.put(cn);
 	attrs.put(passwd);
 	attrs.put(uid);

 	Context result = ctx.createSubcontext  ("cn=simpact,dc=kms,dc=kaist,dc=ac,dc=kr", attrs);

 

 

 

>> objclass.add("cn=kwlee,dc=kms,dc=kaist,dc=ac,dc=kr");

>> objclass.add("person");

>> objclass.add("uidObject");

>>

>> objclass.add("Lee");

>> objclass.add("kw Lee");

>> objclass.add("kwlee");

>> objclass.add("kwlee");

>>

>> attrs.put(objclass);

>>

>> Context result = ctx.createSubcontext("uid=kwlee,cn=kwlee,dc=kms,dc=kaist,dc=ac,dc=kr", attrs);

>>

>>

>> result.close();

>> ctx.close();

>>

>>

>> } catch (Exception e) {

>> out.println("에러가 발생했네요..." + e);

>> } finally {

>> }

>> %>

>>

>> --------------------------------

>>

>> 에러메시지는

>> -------------------------

>> 에러가 발생했네요... javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - objectclass: value #0 contains invalid data]; remaining name 'uid=kwlee,cn=kwlee,dc=kms,dc=kaist,dc=ac,dc=kr'

>> --------------------------

>>

>> 입니다. LDAP 엔트리 추가가는 부분에서 잘못된 데이터가 들어갔다고 하는 걸로 봐서는 뭔가 적어주는 방법이 틀린것 같은데 어떻게 해야할 지 모르겠습니다. 다양하게 해봤는데 모두 실패했습니다.

>>

>> 꼭 좀 도와주십시오... 그럼 이만... 미리 감사드립니다.

>>

>> simpact....

[Top]
No.
제목
작성자
작성일
조회
1149LDAP를 알려면 데이타베이스를 ???
rionkim
2001-10-22
6178
1150┕>Re: LDAP를 알려면 데이타베이스를 ???
정재익
2001-10-22 15:22:15
6940
1148iPlanet Directory에서 LDIF로 화일 입력시 한글 문제..
신응섭
2001-10-22
6170
1152┕>Re: iPlanet Directory에서 .. 좀더 자세히..
dugi
2001-10-23 19:24:07
6812
1171 ┕>Re: Re: iPlanet Directory에서 .. 좀더 자세히..
송상준
2001-10-28 19:24:43
6764
1166┕>Re: iPlanet Directory에서 LDIF로 화일 입력시 한글 문제..
송상준
2001-10-26 18:57:52
7003
1144[질문] LDAP 한글 계정 만들 수 있나요?
김수정
2001-10-18
5902
1142JNDI를 이용해 JSP에서 LDAP Entry 추가
양근우
2001-10-18
6752
1145┕>Re: JNDI를 이용해 JSP에서 LDAP Entry 추가
박근오
2001-10-18 17:02:45
7644
1141송상준님 - Aphelion 디렉토리 서버 테스트?
김태성
2001-10-16
6017
1137Backend DB를 Openldap에서 제공하는 것 이외에도 사용이 가능한지요...
차상균
2001-10-09
6099
1138┕>Re: Backend DB를 Openldap에서 제공하는 것 이외에도 사용이 가능한지요...
박근오
2001-10-11 12:42:37
6385
1134Standard ObjectClass 를 변경하려면?
언니디죠*^^*
2001-10-06
6337
1213┕>[답변]Re: Standard ObjectClass 를 변경하려면?
서호정
2001-11-15 19:40:03
7128
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.029초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다