Re: Failure when creating a new entity using a custom object class that includes a SUP attribute

2013-07-23 Thread Pierre-Arnaud Marcelot
put("objectClass", "orgExtended");
>attributes.put("o", "Test");
>context.createSubcontext(name, attributes);
>}
>catch (final NamingException exception)
>        {
>    System.err.println(exception);
>}
>}
> }
> 
> 
> 
> 
> 
> Emmanuel GUITON
> 
> Ingénieur Développement
> Fixe : +33 1  70 92 84 16 l Standard : +33 1 41 91 77 77
> 
> 215, Avenue Georges Clemenceau l 92024 Nanterre
> http://www.intrinsec.com/
> http://www.intrinsec.com/
> 
> 
> -Message d'origine-
> 
> De : Pierre-Arnaud Marcelot [mailto:paj...@gmail.com] De la part de 
> Pierre-Arnaud Marcelot
> Envoyé : Monday, July 22, 2013 7:26 PM
> À : Apache Directory Developers List
> Cc : Emmanuel GUITON
> Objet : Re: Failure when creating a new entity using a custom object class 
> that includes a SUP attribute
> 
> Hi Emmanuel,
> 
> I don't know if it's your mail client but your mail got to us in a pretty bad 
> shape :(
> 
> Could you try to re-send it again with proper formatting? Thanks!
> 
> Regards,
> Pierre-Arnaud
> 
> On 22 juil. 2013, at 19:17, Emmanuel GUITON  
> wrote:
> 
>> Hello,In an embbeded Apache DS instance, I am trying to add an entity using 
>> a custom object class but it fails. Here is the scenario :First, I set up a 
>> default Apache DS instance, with the schema defined in (maven) : 
>>
>> org.apache.directory.api 
>> api-ldap-schema-data   
>> 1.0.0-M19Then, I add 
>> (programatically) my custom type using the JNDI. This type extends the 
>> 'organization' object class. Browsing the schema with a GUI tool (JXplorer), 
>> I ensure my custom object class was successfully added.After that, I add a 
>> new entity (using the JNDI once again or using the GUI tool) and the 
>> following exception is thrown 
>> :javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - 
>> OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUESTMessage ID : 5   
>>  Add Request :Entrydn[n]: o=Test,dc=company,dc=comobjectClass: 
>> orgExtendedo: TestOpaqueControl ControlType OID: 
>> '2.16.840.1.113730.3.4.2'Criticality : 'false'': ERR_277 Attribute o 
>> not declared in objectClasses of entry o=Test,dc=company,dc=com]; remaining 
>> name 'o=Test,dc=company,dc=com'However, I did specify the value of the 'o' 
>> attribute, which is defined in the parent object class (organization).I 
>> stress that the object class definition includes a SUP attribute. I have 
>> other custom object classes without SUP attribute. I can successfully create 
>> new entities using these other object classes.Is this a bug or am I missing 
>> something ?Hereafter, you can find a complete (client side) code snippet to 
>> repeat this behaviour.Thanks for any help, - emmanuelpackage 
>> com.company.directory.client;import java.util.Hashtable;import 
>> javax.naming.Context;import javax.naming.Name;import 
>> javax.naming.NamingException;import javax.naming.directory.Attributes;import 
>> javax.naming.directory.BasicAttributes;import 
>> javax.naming.directory.DirContext;import 
>> javax.naming.directory.InitialDirContext;import 
>> javax.naming.ldap.LdapName;public class ApacheDsTest{   public static 
>> void main(final String[] args){   try {  
>>  // Init connection to the LDAP server   final 
>> Hashtable env = new Hashtable(); 
>>  env.put(Context.INITIAL_CONTEXT_FACTORY, 
>> "com.sun.jndi.ldap.LdapCtxFactory");   
>> env.put(Context.PROVIDER_URL, TestUtils.PROVIDER_URL);  
>> env.put(Context.SECURITY_AUTHENTICATION, "simple"); 
>> env.put("java.naming.ldap.derefAliases", "always"); 
>> env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");  
>>env.put(Context.SECURITY_CREDENTIALS, "secret");
>> final DirContext context = new InitialDirContext(env);   
>>// Add new objectClass, extends organization  
>>   final Attributes attrs = new BasicAttributes(); 
>> attrs.put("NUMERICOID", "1.3.6.1.4.1.8654.4.1");  

RE: Failure when creating a new entity using a custom object class that includes a SUP attribute

2013-07-22 Thread Emmanuel GUITON
Hi,

Very sorry for the inconvenience, I hope this time will be better :

In an embbeded Apache DS instance, I am trying to add an entity using a custom 
object class but it fails. Here is the scenario :
First, I set up a default Apache DS instance, with the schema defined in 
(maven) :

org.apache.directory.api
api-ldap-schema-data
1.0.0-M19

Then, I add (programatically) my custom type using the JNDI. This type extends 
the 'organization' object class. Browsing the schema with a GUI tool 
(JXplorer), I ensure my custom object class was successfully added.
After that, I add a new entity (using the JNDI once again or using the GUI 
tool) and the following exception is thrown :

javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - 
OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUEST
Message ID : 5
Add Request :
Entry
dn[n]: o=Test,dc=company,dc=com
objectClass: orgExtended
o: Test
OpaqueControl Control
Type OID: '2.16.840.1.113730.3.4.2'
Criticality : 'false'
'
: ERR_277 Attribute o not declared in objectClasses of entry 
o=Test,dc=company,dc=com]; remaining name 'o=Test,dc=company,dc=com'

However, I did specify the value of the 'o' attribute, which is defined in the 
parent object class (organization).
I stress that the object class definition includes a SUP attribute. I have 
other custom object classes without SUP attribute. I can successfully create 
new entities using these other object classes.

Is this a bug or am I missing something ?
Hereafter, you can find a complete (client side) code snippet to repeat this 
behaviour.

Thanks for any help,
 - emmanuel


package com.company.directory.client;

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.ldap.LdapName;

public class ApacheDsTest
{
public static void main(final String[] args)
{
try
{
// Init connection to the LDAP server
final Hashtable env = new 
Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, 
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, TestUtils.PROVIDER_URL);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put("java.naming.ldap.derefAliases", "always");
env.put(Context.SECURITY_PRINCIPAL, 
"uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");
final DirContext context = new InitialDirContext(env);

// Add new objectClass, extends organization
final Attributes attrs = new BasicAttributes();
attrs.put("NUMERICOID", "1.3.6.1.4.1.8654.4.1");
attrs.put("NAME", "orgExtended");
attrs.put("DESC", "Extension of the organization object 
class");
attrs.put("SUP", "organization");
attrs.put("STRUCTURAL", "TRUE");
final DirContext schemaContext = context.getSchema("");

schemaContext.createSubcontext("ClassDefinition/orgExtended", attrs);

// "dn: o=Test,dc=company,dc=com", "objectClass: 
orgExtended", "o: Test"
final Name name = new 
LdapName("o=Test,dc=company,dc=com");
final Attributes attributes=new BasicAttributes();
attributes.put("objectClass", "orgExtended");
attributes.put("o", "Test");
context.createSubcontext(name, attributes);
}
catch (final NamingException exception)
{
System.err.println(exception);
}
}
}





Emmanuel GUITON

Ingénieur Développement
Fixe : +33 1  70 92 84 16 l Standard : +33 1 41 91 77 77

215, Avenue Georges Clemenceau l 92024 Nanterre
http://www.intrinsec.com/
http://www.intrinsec.com/


-Message d'origine-

De : Pierre-Arnaud Marcelot [mailto:paj...@gmail.com] De la part de 
Pierre-Arnaud Marcelot
Envoyé : Monday, July 22, 2013 7:26 PM
À : Apache Directory Developers List
Cc : Emmanuel GUITON
Objet : 

Re: Failure when creating a new entity using a custom object class that includes a SUP attribute

2013-07-22 Thread Pierre-Arnaud Marcelot
Hi Emmanuel,

I don't know if it's your mail client but your mail got to us in a pretty bad 
shape :(

Could you try to re-send it again with proper formatting? Thanks!

Regards,
Pierre-Arnaud

On 22 juil. 2013, at 19:17, Emmanuel GUITON  
wrote:

> Hello,In an embbeded Apache DS instance, I am trying to add an entity using a 
> custom object class but it fails. Here is the scenario :First, I set up a 
> default Apache DS instance, with the schema defined in (maven) :  
>   org.apache.directory.api 
> api-ldap-schema-data 
>   1.0.0-M19Then, I add 
> (programatically) my custom type using the JNDI. This type extends the 
> 'organization' object class. Browsing the schema with a GUI tool (JXplorer), 
> I ensure my custom object class was successfully added.After that, I add a 
> new entity (using the JNDI once again or using the GUI tool) and the 
> following exception is thrown 
> :javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - 
> OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUESTMessage ID : 5
> Add Request :Entrydn[n]: o=Test,dc=company,dc=comobjectClass: 
> orgExtendedo: TestOpaqueControl ControlType OID: 
> '2.16.840.1.113730.3.4.2'Criticality : 'false'': ERR_277 Attribute o 
> not declared in objectClasses of entry o=Test,dc=company,dc=com]; remaining 
> name 'o=Test,dc=company,dc=com'However, I did specify the value of the 'o' 
> attribute, which is defined in the parent object class (organization).I 
> stress that the object class definition includes a SUP attribute. I have 
> other custom object classes without SUP attribute. I can successfully create 
> new entities using these other object classes.Is this a bug or am I missing 
> something ?Hereafter, you can find a complete (client side) code snippet to 
> repeat this behaviour.Thanks for any help, - emmanuelpackage 
> com.company.directory.client;import java.util.Hashtable;import 
> javax.naming.Context;import javax.naming.Name;import 
> javax.naming.NamingException;import javax.naming.directory.Attributes;import 
> javax.naming.directory.BasicAttributes;import 
> javax.naming.directory.DirContext;import 
> javax.naming.directory.InitialDirContext;import 
> javax.naming.ldap.LdapName;public class ApacheDsTest{   public static 
> void main(final String[] args){   try {   
> // Init connection to the LDAP server   final 
> Hashtable env = new Hashtable();  
> env.put(Context.INITIAL_CONTEXT_FACTORY, 
> "com.sun.jndi.ldap.LdapCtxFactory");   
> env.put(Context.PROVIDER_URL, TestUtils.PROVIDER_URL);  
> env.put(Context.SECURITY_AUTHENTICATION, "simple"); 
> env.put("java.naming.ldap.derefAliases", "always"); 
> env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");   
>   env.put(Context.SECURITY_CREDENTIALS, "secret");
> final DirContext context = new InitialDirContext(env);
>   // Add new objectClass, extends organization
> final Attributes attrs = new BasicAttributes(); 
> attrs.put("NUMERICOID", "1.3.6.1.4.1.8654.4.1");
> attrs.put("NAME", "orgExtended");   attrs.put("DESC", 
> "Extension of the organization object class");
> attrs.put("SUP", "organization");   
> attrs.put("STRUCTURAL", "TRUE");final DirContext 
> schemaContext = context.getSchema(""); 
> schemaContext.createSubcontext("ClassDefinition/orgExtended", attrs); 
>   // "dn: o=Test,dc=company,dc=com", 
> "objectClass: orgExtended", "o: Test"final Name name 
> = new LdapName("o=Test,dc=company,dc=com"); final 
> Attributes attributes=new BasicAttributes();  
> attributes.put("objectClass", "orgExtended");   
> attributes.put("o", "Test");
> context.createSubcontext(name, attributes); }   catch 
> (final NamingException exception) {   
> System.err.println(exception);  }   }}
> 
> 
> Emmanuel GUITON
> 
> Ingénieur Développement
> Fixe : +33 1  70 92 84 16 l Standard : +33 1 41 91 77 77
> 
> 215, Avenue Georges Clemenceau l 92024 Nanterre
> http://www.intrinsec.com/
> http://www.intrinsec.com/
> 
> 
> 
> 



Re: Failure when creating a new entity using a custom object class that includes a SUP attribute

2013-07-22 Thread Emmanuel Lécharny
Ouille les yeux !!!

Could you resend the same mail in plain text please ?



Le 7/22/13 7:17 PM, Emmanuel GUITON a écrit :
> Hello,In an embbeded Apache DS instance, I am trying to add an entity using a 
> custom object class but it fails. Here is the scenario :First, I set up a 
> default Apache DS instance, with the schema defined in (maven) :  
>   org.apache.directory.api 
> api-ldap-schema-data 
>   1.0.0-M19Then, I add 
> (programatically) my custom type using the JNDI. This type extends the 
> 'organization' object class. Browsing the schema with a GUI tool (JXplorer), 
> I ensure my custom object class was successfully added.After that, I add a 
> new entity (using the JNDI once again or using the GUI tool) and the 
> following exception is thrown 
> :javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - 
> OBJECT_CLASS_VIOLATION: failed for MessageType : ADD_REQUESTMessage ID : 5
> Add Request :Entrydn[n]: o=Test,dc=company,dc=comobjectClass: 
> orgExtendedo: TestOpaqueControl ControlType OID: 
> '2.16.840.1.113730.3.4.2'Criticality : 'false'': ERR_277 Attribute o 
> not declared in objectClasses of entry o=Test,dc=company,dc=com]; remaining 
> name 'o=Test,dc=company,dc=com'However, I did specify the value of the 'o' 
> attribute, which is defined in the parent object class (organization).I 
> stress that the object class definition includes a SUP attribute. I have 
> other custom object classes without SUP attribute. I can successfully create 
> new entities using these other object classes.Is this a bug or am I missing 
> something ?Hereafter, you can find a complete (client side) code snippet to 
> repeat this behaviour.Thanks for any help, - emmanuelpackage 
> com.company.directory.client;import java.util.Hashtable;import 
> javax.naming.Context;import javax.naming.Name;import 
> javax.naming.NamingException;import javax.naming.directory.Attributes;import 
> javax.naming.directory.BasicAttributes;import 
> javax.naming.directory.DirContext;import 
> javax.naming.directory.InitialDirContext;import 
> javax.naming.ldap.LdapName;public class ApacheDsTest{   public static 
> void main(final String[] args){   try {   
> // Init connection to the LDAP server   final 
> Hashtable env = new Hashtable();  
> env.put(Context.INITIAL_CONTEXT_FACTORY, 
> "com.sun.jndi.ldap.LdapCtxFactory");   
> env.put(Context.PROVIDER_URL, TestUtils.PROVIDER_URL);  
> env.put(Context.SECURITY_AUTHENTICATION, "simple"); 
> env.put("java.naming.ldap.derefAliases", "always"); 
> env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");   
>   env.put(Context.SECURITY_CREDENTIALS, "secret");
> final DirContext context = new InitialDirContext(env);
>   // Add new objectClass, extends organization
> final Attributes attrs = new BasicAttributes(); 
> attrs.put("NUMERICOID", "1.3.6.1.4.1.8654.4.1");
> attrs.put("NAME", "orgExtended");   attrs.put("DESC", 
> "Extension of the organization object class");
> attrs.put("SUP", "organization");   
> attrs.put("STRUCTURAL", "TRUE");final DirContext 
> schemaContext = context.getSchema(""); 
> schemaContext.createSubcontext("ClassDefinition/orgExtended", attrs); 
>   // "dn: o=Test,dc=company,dc=com", 
> "objectClass: orgExtended", "o: Test"final Name name 
> = new LdapName("o=Test,dc=company,dc=com"); final 
> Attributes attributes=new BasicAttributes();  
> attributes.put("objectClass", "orgExtended");   
> attributes.put("o", "Test");
> context.createSubcontext(name, attributes); }   catch 
> (final NamingException exception) {   
> System.err.println(exception);  }   }}
>
>
> Emmanuel GUITON
>
> Ingénieur Développement
> Fixe : +33 1  70 92 84 16 l Standard : +33 1 41 91 77 77
>
> 215, Avenue Georges Clemenceau l 92024 Nanterre
> http://www.intrinsec.com/
> http://www.intrinsec.com/
>
>
>
>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 




Failure when creating a new entity using a custom object class that includes a SUP attribute

2013-07-22 Thread Emmanuel GUITON
Hello,In an embbeded Apache DS instance, I am trying to add an entity using a 
custom object class but it fails. Here is the scenario :First, I set up a 
default Apache DS instance, with the schema defined in (maven) :
org.apache.directory.api 
api-ldap-schema-data   
1.0.0-M19Then, I add 
(programatically) my custom type using the JNDI. This type extends the 
'organization' object class. Browsing the schema with a GUI tool (JXplorer), I 
ensure my custom object class was successfully added.After that, I add a new 
entity (using the JNDI once again or using the GUI tool) and the following 
exception is thrown :javax.naming.directory.SchemaViolationException: [LDAP: 
error code 65 - OBJECT_CLASS_VIOLATION: failed for MessageType : 
ADD_REQUESTMessage ID : 5Add Request :Entrydn[n]: 
o=Test,dc=company,dc=comobjectClass: orgExtendedo: Test
OpaqueControl ControlType OID: '2.16.840.1.113730.3.4.2'
Criticality : 'false'': ERR_277 Attribute o not declared in objectClasses of 
entry o=Test,dc=company,dc=com]; remaining name 
'o=Test,dc=company,dc=com'However, I did specify the value of the 'o' 
attribute, which is defined in the parent object class (organization).I stress 
that the object class definition includes a SUP attribute. I have other custom 
object classes without SUP attribute. I can successfully create new entities 
using these other object classes.Is this a bug or am I missing something 
?Hereafter, you can find a complete (client side) code snippet to repeat this 
behaviour.Thanks for any help, - emmanuelpackage 
com.company.directory.client;import java.util.Hashtable;import 
javax.naming.Context;import javax.naming.Name;import 
javax.naming.NamingException;import javax.naming.directory.Attributes;import 
javax.naming.directory.BasicAttributes;import 
javax.naming.directory.DirContext;import 
javax.naming.directory.InitialDirContext;import 
javax.naming.ldap.LdapName;public class ApacheDsTest{   public static void 
main(final String[] args){   try {  
 // Init connection to the LDAP server   final 
Hashtable env = new Hashtable();
  env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); 
  env.put(Context.PROVIDER_URL, TestUtils.PROVIDER_URL);
  env.put(Context.SECURITY_AUTHENTICATION, "simple");   
  env.put("java.naming.ldap.derefAliases", "always"); 
env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system"); 
env.put(Context.SECURITY_CREDENTIALS, "secret");final 
DirContext context = new InitialDirContext(env);
  // Add new objectClass, extends organizationfinal 
Attributes attrs = new BasicAttributes(); 
attrs.put("NUMERICOID", "1.3.6.1.4.1.8654.4.1");
attrs.put("NAME", "orgExtended");   attrs.put("DESC", 
"Extension of the organization object class");
attrs.put("SUP", "organization");   attrs.put("STRUCTURAL", 
"TRUE");final DirContext schemaContext = 
context.getSchema(""); 
schemaContext.createSubcontext("ClassDefinition/orgExtended", attrs);   
// "dn: o=Test,dc=company,dc=com", 
"objectClass: orgExtended", "o: Test"final Name name = 
new LdapName("o=Test,dc=company,dc=com"); final Attributes 
attributes=new BasicAttributes();  
attributes.put("objectClass", "orgExtended");   
attributes.put("o", "Test");context.createSubcontext(name, 
attributes); }   catch (final NamingException 
exception) {   System.err.println(exception);   
   }   }}


Emmanuel GUITON

Ingénieur Développement
Fixe : +33 1  70 92 84 16 l Standard : +33 1 41 91 77 77

215, Avenue Georges Clemenceau l 92024 Nanterre
http://www.intrinsec.com/
http://www.intrinsec.com/