javax.naming.PartialResultException: Unprocessed Continuation Reference(s);

[nobr]Hello above all to you steven ;-)

I get this JNDI error performing my ldap password change:

javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name''

The double quote above at the end of the error msg is actually 2 single quotes just to let you know...

the password for the new user is in the String "test" below in the code and the username of the user i do enter in the usernameTF Field.

This is taken from the ldap error code table:

9 Partial results being returned. If the environment property"java.naming.referral" is set to"ignore" or the contents of the errordo not contain a referral,throw a PartialResultException. Otherwise, use contents to build a referral.

http://java.sun.com/javase/6/docs/api/javax/naming/PartialResultException.html

But i dont understand it... Can you help guys ?

import java.awt.Color;

import java.awt.Insets;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.*;

import org.jvnet.substance.button.ClassicButtonShaper;

import org.jvnet.substance.SubstanceLookAndFeel;

import org.jvnet.substance.theme.SubstanceAquaTheme;

import org.jvnet.substance.painter.WaveGradientPainter;

import javax.naming.directory.*;

import java.util.Hashtable;

import javax.naming.Context;

import javax.naming.*;

import java.io.UnsupportedEncodingException;

publicclass MainWindowextends JFrameimplements ActionListener

{staticfinallong serialVersionUID = 1;

private JLabel usernameLB =new JLabel("Username");

private JLabel headerLB=new JLabel("<html><b>Set new teacher/pupil password:</b></html>");

private JLabel newPasswordLB =new JLabel("New password");

private JLabel newPasswordRepeatLB =new JLabel("New password repeat");

private JLabel errorLB =new JLabel("error status:");

private JTextField newPasswordTF =new JTextField();

//private JPasswordField neukennwortwdhPF = new JPasswordField(10);

private JTextField usernameTF =new JTextField ();

private JTextField errorTF =new JTextField();

private JButton pwBT =new JButton("<html>SET new password<br></html>");

private JSeparator vline =new JSeparator();

String adminPassword ="test";

String adminUser ="cn=administrator,cn=users,dc=bodensee,dc=de";

static String FILTER_USERS ="(&(objectclass=user)(sAMAccountName={0}))";

public MainWindow()

{

super("LDAP Modification Tool");

UIManager.put("swing.boldMetal", Boolean.FALSE);

setLayout(null);

add(usernameLB);

add(vline);

add(headerLB);

add(newPasswordLB);

add(newPasswordRepeatLB);

//add(neukennwortwdhPF);

add(newPasswordTF);

add(usernameLB);

add(usernameTF);

add(pwBT);

add(errorLB);

add(errorTF);

headerLB.setBounds(20,20,300,25);

vline.setBounds(20,40,330,2);

usernameLB.setBounds(20,60,150,25);

usernameTF.setBounds(200,60,150,25);

newPasswordTF.setBounds(200,90,150,25);

// neukennwortwdhPF.setBounds(200,120,150,25);

newPasswordLB.setBounds(20,90,130,25);

newPasswordRepeatLB.setBounds(20,120,160,25);

pwBT.setBounds(200,150,150,40);

errorLB.setBounds(20,210,100,25);

errorTF.setBounds(110,210,850,25);

usernameTF.setMargin(new Insets(1,3,1,1));

newPasswordTF.setMargin(new Insets(1, 3, 1, 1));

// neukennwortwdhPF.setMargin(new Insets(1, 3, 1, 1));

usernameLB.setForeground(new Color(40,120,40));

newPasswordLB.setForeground(new Color(40,120,40));

newPasswordRepeatLB.setForeground(new Color(40,120,40));

pwBT.setForeground(new Color(0,0,170));

headerLB.setForeground(new Color(40,120,40));

usernameLB.setForeground(new Color(40,120,40));

errorTF.setEditable(false);

errorTF.setBackground(new Color(220,220,220));

errorTF.setForeground(new Color(40,120,40));

errorLB.setForeground(new Color(40,120,40));

pwBT.setIcon(new ImageIcon("key.png"));

vline.setOrientation(0);

pwBT.addActionListener(this);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

this.setSize(980,275);

this.setLocationRelativeTo(null);

this.setResizable(false);

this.setVisible(true);

}//...................................... KONSTRUKTOR ENDE ........................................ //

publicvoid actionPerformed(ActionEvent e)

{

if (e.getSource().equals(pwBT))

{

Hashtable env =new Hashtable();

String keystore ="C:/Programme/Java/jre1.6.0_01/lib/security/ZertifikatBerlin";

System.setProperty("javax.net.ssl.trustStore",keystore);

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

env.put(Context.PROVIDER_URL,"ldaps://rhein:636/dc=bodensee,dc=de");

env.put(Context.SECURITY_PROTOCOL,"SSL");

env.put(Context.SECURITY_AUTHENTICATION,"simple");

env.put(Context.SECURITY_PRINCIPAL, adminUser);

env.put(Context.SECURITY_CREDENTIALS,adminPassword);

try

{// Durchsucht die Active Directory nach dem Benutzernamen der eingegeben wurde

InitialDirContext ctx =new InitialDirContext(env);

NamingEnumeration enm = ctx.search("", FILTER_USERS,new String[]{usernameTF.getText()},null);

if (!enm.hasMore())

{

errorTF.setText("The user does not exist in the Active Directory!");

}

else

{

SearchResult result = (SearchResult) enm.next();

DirContext userCtx = (DirContext) result.getObject();

// Wert f黵 das Kenntwort in der Activev Directory erzeugen

String neuesKennwort="test";//newPasswordTF.getText();

String neuesKennwortAD ="\"" + neuesKennwort +"\"";

byte bytes[] = neuesKennwortAD.getBytes("UTF-16LE");

// The username to be used for the password change

String username = usernameTF.getText();

ModificationItem mods[] =new ModificationItem[1];

mods[0] =new ModificationItem(DirContext.REPLACE_ATTRIBUTE,new BasicAttribute("unicodePwd", bytes));

userCtx.modifyAttributes(username,mods);

}

ctx.close();

errorTF.setText("Connection closed");

}

catch (Exception er)

{

errorTF.setText(er.toString());

}

}

}

publicstaticvoid main(String args[])throws NamingException, UnsupportedEncodingException

{

SubstanceLookAndFeel slnf =new SubstanceLookAndFeel();

SubstanceLookAndFeel.setCurrentTheme(new SubstanceAquaTheme());

SubstanceLookAndFeel.setCurrentButtonShaper(new ClassicButtonShaper());

SubstanceLookAndFeel.setCurrentGradientPainter(new WaveGradientPainter());

try

{

UIManager.setLookAndFeel(slnf);

JFrame.setDefaultLookAndFeelDecorated(true);

}

catch (Exception e)

{

e.printStackTrace();

}

MainWindow Fenster =new MainWindow ();

}

}

EDIT:

I have just hardcoded the username now into the code:

String username = "cn=verena bit,ou=lehrer,ou=asr,dc=bodensee,dc=de";

and NOW i get suddenly this error:

javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C090534, comment: Error processing filter, data 0, v893

Message was edited by:

4th

**** am I confused... i totally forgot that i make a username search in the AD and expect the username to be entered in the usernameTF Field... maybe thats the reason so we should rather try to solve the first error statement...

ok I just changed now this:

NamingEnumeration enm = ctx.search("", FILTER_USERS,new String[]{usernameTF.getText()},null);

into this:

NamingEnumeration enm = ctx.search("", FILTER_USERS,new String[]{"cn=verena bit,ou=lehrer,ou=asr,dc=bodensee,dc=de"},null);

now i have the first error msg again...

Message was edited by:

4th[/nobr]

[13168 byte] By [4tha] at [2007-11-27 9:43:39]
# 1

This may be related to the problem in yoru previous post.

If you refer to the error message, the continuation reference is being thrown when a referral is generated and you have not specified whether to follow, ignore or throw the referral.

In anycase, if it is indeed related to your previous post, the referral will be moot, as the referral is being returned because you have incorrectly specified either base distinguished name in your ldapurl or in the relative distinguished name of the user object.

adler_stevena at 2007-7-12 23:49:19 > top of Java-index,Core,Core APIs...