jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaizer <Kaiz...@mastek.com>
Subject Re: Problem adding a child node
Date Mon, 03 Sep 2007 15:29:39 GMT

I am getting a similar exception on adding nodes. 

Node hello = root.addNode("hello","nt:base");
Node world = hello.addNode("world","nt:base");

javax.jcr.nodetype.ConstraintViolationException: no definition found in
parent node's node type for new node: no matching child node definition
found for {}world: no matching child node definition found for {}world

What should i do in this case?

Thanks.




JavaJ wrote:
> 
> Given the following node types:
> 
> [cm:myAppContainer] > nt:base,mix:referenceable,mix:versionable
> + cm:myApp (cm:myApp) = cm:myApp multiple version
> 
> [cm:myApp] > nt:base,mix:referenceable,mix:versionable
> - cm:size (long) mandatory
> - cm:rules mandatory
> - cm:locale mandatory
> - cm:address mandatory
> 
> I'm getting an error when I try to add a "myApp" child node to
> "myAppContainer".
> 
> For example:
> 
> // get the "myAppContainer" node
> Node container = rootNode.get("/nodes/myAppContainer");
> 
> // get the child node definitions to make sure it contains "myApp" child
> node definition
> NodeDefinition[] defs =
> container.getPrimaryNodeType().getDeclaredChildNodeDefinitions();
> 
> // add a new "myApp" node
> newNode = container.addNode("myNewAppNode", "cm:myApp");
> 
> I get this error on this call:
> 
> javax.jcr.nodetype.ConstraintViolationException: no definition found in
> parent node's node type for new node: 
> no matching child node definition found for {}myNewAppNode: 
> 
> Is there something I'm doing wrong???
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-adding-a-child-node-tf2065497.html#a12463572
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message