Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ctx.getAttributes("cn....  RSS feed

 
Tom Hut
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
creates this error:

the method getAttributes(String, String[]) is undefined for the type Context

i just copied the code, so it wasn't me....

following packages i'd imported:

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.directory.*;
import javax.naming.*;
import java.util.*;
import java.lang.Object;

what'S wrong??? plz help
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont think there is a method called getAttributes in Context
that is what the compiler is complaining

cheers,
parthi
 
Tom Hut
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, but why is this code then an example?!?

Source: web page

I just wann get a connection to the ldap....and read some attributes
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please read the same tutorial from the start,
web page

e481 is the related example

its not javax.naming.Context
they are using javax.naming.directory.InitialDirContext;

Hope that helps

cheers,
parthi
 
Tom Hut
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, thx a lot!

may you help me once again?

on e482 there is
process(attr);

i get this
error message:
the method process(Attribute) is undefined for the type myClass

what is wrong? is there missing some package / class again?

thx
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's something the example assumes that you will do,
process(attr) is not a real method,

it can be doMyProcess(attr);
where doMyProcess is a method u will write to process these attributes on our own,

hope that helps,
cheer,
parthi
 
Tom Hut
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, now I understand. Thanks.

could you give me an example for a process method?

is the var attr a String array?

i hope you will excuse my noob questions but this i the first time I programm a LDAP access...and I'm still a little bit confused.
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.naming.directory.Attributes
javax.naming.directory.Attribute

the best thing would be to download hte Java-API docs and go thorugh the package you are trying to deal with,
unfortunately i dont have much experince with LDAP
google would be the best bet to come up with answeres and tutorials.
sorry could not be of more help

cheers,
parthi.
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have a look at these links
http://java.sun.com/developer/Books/ldap/
http://www.javaworld.com/javaworld/jw-03-2000/jw-0324-ldap.html
http://www.sbfsbo.com/mike/JndiTutorial/

hope they get you going

cheers,
parthi
 
Tom Hut
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for helping me!

one more question:

do you know this error message:

xception while reading from Context:
javax.naming.InvalidNameException: ou=address ,o=Sto AG, : [LDAP: error code 34 - Invalid DN Syntax]; remaining name 'ou=address ,o=Sto AG, '
javax.naming.InvalidNameException: ou=address ,o=Sto AG, : [LDAP: error code 34 - Invalid DN Syntax]; remaining name 'ou=address ,o=Sto AG, '
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.searchAux(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
at javax.naming.directory.InitialDirContext.search(Unknown Source)
at Bsp.main(Bsp.java:64)


thx!
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take it that you are trying to bind an attribute to this context,
it simply means the convention that you have followed to bind is not acceptable by your provider

cheers,
parthi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!