You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Francisco Alvarez Lopez <fr...@hotmail.com> on 2009/01/12 08:50:21 UTC

create new node



From: franalop@hotmail.comTo: sling-dev@incubator.apache.orgSubject: HelpDate: Mon, 12 Jan 2009 08:39:07 +0100


Hello, 
I'm trying Sling Apache Tomcat 6.0 and in the form below: 
 
<html><head> <title>Sling: Create new node</title> </head><body><form action="http://admin:admin@localhost:8080/sling/content/*" method="POST"> <h2>Título</h2> <input type="text" name="title"> </input> <h2>Descripción</h2> <textarea rows="5" type="text" name="Descripcion"> </textarea>  <input type="hidden" name="jcr:primaryType" value="nt:unstructured">  <input type="submit" value="save"/></form></body></html>I get an error the following error message:
 

Error while processing /content/a



Status

500

Message

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

Location
/sling/content/a

Parent Location
/sling/content

Path

/content/a

Referer
http://localhost:8080/sling/prueba.html

ChangeLog

Go BackModified ResourceParent of Modified Resource
 
What could it be? 

 
I want to create a new nodeThank you.

Charlas más divertidas con el nuevo Windows Live Messenger
_________________________________________________________________
Descubre todas las formas en que puedes estar en contacto con amigos y familiares.
http://www.microsoft.com/windows/windowslive/default.aspx

Re: create new node

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Mon, Jan 12, 2009 at 12:56 PM, Juan José Vázquez Delgado
<ju...@gmail.com> wrote:
> Hi Francisco,
>
> javax.jcr.nodetype.ConstraintViolationException: no definition found in
>> parent node's node type for new node: no matching child node definition
>> found for {}a: no matching child node definition found for {}a
>>
>
> Node "/sling/content"  should be a "nt:unstructured" node. Is
> "/sling/content" a nt:folder maybe?...

This might happen if you have created the /content node via WebDAV,
for example - if you create it directly with a form that posts to
/content/* and /content does not exist yet, that should work.

-Bertrand

Re: create new node

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
Hi Francisco,

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

Node "/sling/content"  should be a "nt:unstructured" node. Is
"/sling/content" a nt:folder maybe?

BR,

Juanjo

Re: create new node

Posted by Alexander Klimetschek <ak...@day.com>.
This means that the nodetype of the node /content does not allow
arbitrary child nodes. Node types are a feature of JCR to put
constraints on child nodes and properties, eg. only allow "title",
"date" and "author" as properties and only subnodes of the node type
"book" [1]. But an important feature of JCR is that it allows to
define so-called residual properties and nodes (defining "*" in the
node type definition) that allows any nodes (also of any node type).
There is a built-in node type "nt:unstructured" that allows any
property and child node. The often used nt:file and nt:folder (and I
think /content is a nt:folder in Sling by default), are not so
flexible [2]. Since node types cannot be changed once the node was
created, you can add and remove any number of mixins to the node. For
node types and mixins and their definition in Jackrabbit see [3].

Sling contains a "sling:Folder" nodetype that works like nt:folder but
allows arbitrary child nodes and properties as well (like
nt:unstructured), and that one should be used for things like /content
(because nt:folder is useful when you mount the repository as WebDAV.

[1] http://www.day.com/specs/jcr/1.0/6.7_Node_Types.html
[2] http://www.day.com/specs/jcr/1.0/6.7.22.8_nt_folder.html
[3] http://jackrabbit.apache.org/node-types.html

Regards,
Alex

On Mon, Jan 12, 2009 at 8:50 AM, Francisco Alvarez Lopez
<fr...@hotmail.com> wrote:
>
>
>
> From: franalop@hotmail.comTo: sling-dev@incubator.apache.orgSubject: HelpDate: Mon, 12 Jan 2009 08:39:07 +0100
>
>
> Hello,
> I'm trying Sling Apache Tomcat 6.0 and in the form below:
>
> <html><head> <title>Sling: Create new node</title> </head><body><form action="http://admin:admin@localhost:8080/sling/content/*" method="POST"> <h2>Título</h2> <input type="text" name="title"> </input> <h2>Descripción</h2> <textarea rows="5" type="text" name="Descripcion"> </textarea>  <input type="hidden" name="jcr:primaryType" value="nt:unstructured">  <input type="submit" value="save"/></form></body></html>I get an error the following error message:
>
>
> Error while processing /content/a
>
>
>
> Status
>
> 500
>
> Message
>
> javax.jcr.nodetype.ConstraintViolationException: no definition found in parent node's node type for new node: no matching child node definition found for {}a: no matching child node definition found for {}a
>
> Location
> /sling/content/a
>
> Parent Location
> /sling/content
>
> Path
>
> /content/a
>
> Referer
> http://localhost:8080/sling/prueba.html
>
> ChangeLog
>
> Go BackModified ResourceParent of Modified Resource
>
> What could it be?
>
>
> I want to create a new nodeThank you.
>
> Charlas más divertidas con el nuevo Windows Live Messenger
> _________________________________________________________________
> Descubre todas las formas en que puedes estar en contacto con amigos y familiares.
> http://www.microsoft.com/windows/windowslive/default.aspx



-- 
Alexander Klimetschek
alexander.klimetschek@day.com