[Date Prev][Date Next] [Chronological] [Thread] [Top]

Problems LDAP ==> Java



Hi all,

First sorry for this long posting :) 


I have the following Problem I have programmed some Application in Java,
where I can make a modify, search , destroy and add Entries.
Everything works till I want to add some entrie.

I become in Java following errors :

javax.naming.directory.InvalidAttributeValueException: Malformed
'hypAppServer' attribute value;

The API means:

"This class is thrown when an attempt is made to add to an attribute a value
that conflicts with the attribute's schema definition. This could happen,
for example, if attempting to add an attribute with no value when the
attribute is required to have at least one value, or if attempting to add
more than one value to a single valued-attribute, or if attempting to add a
value that conflicts with the syntax of the attribute."" 


Here you can see a cutscene of my local.schema 

attributeType ( 1.3.6.1.4.1.12805 NAME 'hypAppServer'
        DESC    'hypAppServer'
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.27)

attributeType ( 1.3.6.1.4.1.12806 NAME 'hypLogLevel' DESC 'Logevel
intensity' SUP hypAppServer )

attributeType ( 1.3.6.1.4.1.12807 NAME 'hypLogStatistics' DESC
'LogStatistics of the AppServer' SUP hypAppServer )

attributeType ( 1.3.6.1.4.1.12808 NAME 'hypLogDevices' DESC 'Output of the
Logmessages' SUP hypAppServer )



Here a cutscence of my programm the ldapdd function

public static void ldapadd(String aUsername, String aPassword)
  {
     try
    {

        Hashtable env = setEnviroment(aUsername, aPassword);
        DirContext ctx = new InitialDirContext(env);

        Attributes attrs = new BasicAttributes(true); // case-ignore

        Attribute objclass = new BasicAttribute("objectclass");
        objclass.add("hyperdocperson");

        //////////hypServerHostName///////////
        Attribute hypServerHostName = new
BasicAttribute("hypServerHostName");
        hypServerHostName.add("schubi2002");
        //////////Port///////////
        Attribute hypPort = new BasicAttribute("hypPort");
        hypPort.add("2020");
        //////////Domain///////////
        Attribute hypDomainName = new BasicAttribute("hypDomainName");
        hypDomainName.add("hyperdoc");
        //////////UserName///////////
        Attribute hypUserName = new BasicAttribute("hypUserName");
        hypUserName.add("schubi");
        //////////Password///////////
        Attribute userPassword = new BasicAttribute("userPassword");
        userPassword.add("schubi");
        //////////hypAppServer///////////
        Attribute hypAppServer = new BasicAttribute("hypAppServer");
        hypAppServer.add(new Integer("2"));
        //////////hypLogLevel///////////
        Attribute hypLogLevel = new BasicAttribute("hypLogLevel");
        hypLogLevel.add(new Integer("1"));
        //////////hypLogStatistics///////////
        Attribute hypLogStatistics = new BasicAttribute("hypLogStatistics");
        hypLogStatistics.add(new Integer("2"));
        //////////hypLogDevices///////////
        Attribute hypLogDevices = new BasicAttribute("hypLogDevices");
        hypAppServer.add(new Integer("23"));
        //////////hypLogFile///////////
        Attribute hypLogFile = new BasicAttribute("hypLogFile");
        hypLogFile.add("c://TEMP/log4you.log");
        //////////hypClientVersion///////////
        Attribute hypClientVersion = new BasicAttribute("hypClientVersion");
        hypClientVersion.add("Version2");
        //////////sn///////////
        Attribute sn = new BasicAttribute("sn");
        sn.add("schubert");
        //////////cn///////////
        Attribute cn = new BasicAttribute("cn");
        cn.add("schubertm");
        //////////hypPassword///////////
        Attribute hypPassword = new BasicAttribute("hypPassword");
        cn.add("akakak");


      attrs.put(objclass);
      attrs.put(hypServerHostName);
      attrs.put(hypPort);
      attrs.put(hypDomainName);
      attrs.put(hypUserName);
      attrs.put(hypPassword);
      attrs.put(hypAppServer);
      attrs.put(hypLogLevel);
      attrs.put(hypLogStatistics);
      attrs.put(hypLogDevices);
      attrs.put(hypLogFile);
      attrs.put(hypClientVersion);
      attrs.put(cn);
      attrs.put(sn);
      attrs.put(userPassword);


        // Create the context
        Context result =
ctx.createSubcontext("cn=schubertm,ou=s,ou=hyperdoc,dc=iqdoq,dc=de", attrs);
   }
    catch(Exception e)
    {
      e.printStackTrace();
      System.exit(1);
    }
  }


But you can see in my localschema that I have the attribute hypappserver
defined as an Inetger and In Java I have the also take to write an Integer

(in LDAP)

attributeType ( 1.3.6.1.4.1.12805 NAME 'hypAppServer'
        DESC    'hypAppServer'
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.27)

(in Java)

 Attribute hypAppServer = new BasicAttribute("hypAppServer");
        hypAppServer.add(new Integer("2"));

Can anybody help me or say why this error occurs .


Thanks in advance 

regards
Ferruh