jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Rhodes <spamsu...@rhoderunner.com>
Subject Re: Beginner cnd question
Date Sun, 20 May 2007 06:03:08 GMT
Hi Jacco,

You suggestion definitely helped since I can now process my cnd file without an exception,
thank you.
At this point, whenever I do try to add a node, it errors out with a "no matching child node
definition found for {}Tag 0"  

I figured out that I can add the node successfully if I specify a node name that matches what
I specify in the cnd (by using "stitches:tags" instead of "Tag 0" as the node name), but is
there a way to specify the node name dynamically?  I want to specify that I am adding a node
with this name, and with this type to this node.  

//here is a simple java code that illustrates what I am doing
Node rn = session.getRootNode();
Node folderNode = rn.addNode("a folder", "stitches:folder");
//this is broken
Node node = folderNode.addNode("Tag 0", "stitches:tag");
//this will work, but how do I specify the name of the tag?  Right now, it is locked in as
"stitches:tags"
Node node = folderNode.addNode("stitches:tags","stitches:tag");


Here is my current CND file.

<nt = 'http://www.jcp.org/jcr/nt/1.0'>
<stitches = 'http://stitches.authsum.com/stitches'>

/* This is a simple tag */
[stitches:tag] > nt:resource

/* the stitch folder extends the nt:folder */
[stitches:folder] > nt:folder
  - stitches:contentType (string)  
  + stitches:tags (stitches:tag)   


Here is my entire stack trace, again, I really appreciate everyone's help!
Phillip


org.springframework.dao.DataIntegrityViolationException: Constraint has been violated; nested
exception is javax.jcr.nodetype.ConstraintViolationException: no definition found in parent
node's node type for new node: no matching child node definition found for {}Tag 0: no matching
child node definition found for {}Tag 0
Caused by: javax.jcr.nodetype.ConstraintViolationException: no definition found in parent
node's node type for new node: no matching child node definition found for {}Tag 0: no matching
child node definition found for {}Tag 0
	at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:774)
	at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:740)
	at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:687)
	at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1926)
	at org.authsum.stitches.server.StitchServiceImpl.getNode(StitchServiceImpl.java:614)
	at org.authsum.stitches.server.StitchServiceImpl.access$5(StitchServiceImpl.java:605)
	at org.authsum.stitches.server.StitchServiceImpl$9.doInJcr(StitchServiceImpl.java:591)
	at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:76)
	at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:108)
	at org.authsum.stitches.server.StitchServiceImpl.saveTag(StitchServiceImpl.java:576)
	at org.authsum.stitches.server.StitchServiceImpl$$FastClassByCGLIB$$56f432d3.invoke(<generated>)
	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
	at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:675)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)





----- Original Message -----
From: "Jacco van Weert" <1111software@gmail.com>
To: users@jackrabbit.apache.org
Sent: Saturday, May 19, 2007 4:41:29 PM (GMT-0500) America/New_York
Subject: Re: Beginner cnd question

Hello Philip,

I think you must swap the sequence of node types definitions.
So first define stitches:tag and then define stitches:folder in which you
use stitches:tag

Greetings,

   Jacco




On 5/19/07, Phillip Rhodes <spamsucks@rhoderunner.com> wrote:
>
> I am starting out with cnd.  I am  successfully registering some simple
> node types programmatically on my repo startup.
>
> My question is that I am trying to setup a custom node type that extends
> an nt:folder to be able to hold objects of type "stitch:tag"
> I have been trying several different ways in cnd to represent this, but
> haven't got the cnd working yet.
> Here is the latest cnd that is generating this error:
>
> <nt = 'http://www.jcp.org/jcr/nt/1.0'>
> <stitches = 'http://stitches.authsum.com/stitches'>
>
> /* the stitch folder extends the nt:folder */
> [stitches:folder] > nt:folder
> - stitches:contentType (string)
> + stitches:tag (stitches:tag)
>
>
> /* This is a simple tag */
> [stitches:tag] > nt:resource
>
>
> I want to say how thankful I am to this community for helping me out so
> far, I hope I can return the favor by the success of this open source
> library that will allow drop in components to manage common objects in the
> web world (e.g. images, html, etc).
>
> This version fails with a
> org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException: [{
> http://stitches.authsum.com/stitches}folder#{http://stitches.authsum.com/stitches}tag]
> invalid required primary type: {http://stitches.authsum.com/stitches}tag
>        at
> org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.validateNodeTypeDef(
> NodeTypeRegistry.java:1655)
>        at
> org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.internalRegister(
> NodeTypeRegistry.java:1158)
>        at
> org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.registerNodeType(
> NodeTypeRegistry.java:174)
>        at
> org.authsum.stitches.server.StitchServiceImpl.RegisterCustomNodeTypes(
> StitchServiceImpl.java:236)
>        at org.authsum.stitches.server.StitchServiceImpl$1.doInJcr(
> StitchServiceImpl.java:177)
>
>
>


Mime
View raw message