jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: child node definition found for {}importxml
Date Fri, 23 Jan 2009 20:50:25 GMT
hi chris

On Fri, Jan 23, 2009 at 7:05 PM, Christofer Dutz <c.dutz@upw.de> wrote:
> Hi,
>
>
>
> Yesterday I started playing around with jackrabbit. In the meanwhile i think
> I have a lot of stuff worked out. Unfortunately I am missing one thing form
> y prototype to work:
>
>
>
> I want to create the folowing structure:
>
>
>
> /definitions/{definition-documents}
>
>
>
> I managed to get the Xml Import working using the sessions
> getImportContentHandler method and quite some registerNamespace calls.
>
> Unfortunately this only seems to work when saving to direct children of my
> repository. As soon as I create a folder using
> "rootNode.addNode("definitions", "nt:folder");" I get the following
> stacktrace: (adding my xml content to a node called "/documents/importxml"

the node type nt:folder only allows child nodes of type nt:hierarchyNode,
i.e. nt:folder and nt:file. it is used to model file system like hierarchies.

what you want to use is nt:unstructured, which allows child nodes of any type.

rootNode.addNode("definitions", "nt:folder");

or

rootNode.addNode("definitions");

(nt:unstructured is the default).

see e.g.

rootNode.addNode("definitions", "nt:folder");

for a description of some built-in used node types,
see e.g.

http://wiki.apache.org/jackrabbit/NodeTypeRegistry

cheers
stefan

>
>
>
> javax.jcr.nodetype.ConstraintViolationException: no definition found in
> parent node's node type for new node: no matching child node definition
> found for {}importxml: no matching child node definition found for
> {}importxml
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:763)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:729)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:677)
>
>      at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:2110)
>
>      at
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManager.addDef
> initions(JackrabbitPersistenceManager.java:264)
>
>      at
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManagerTest.ad
> dDefintionsTest(JackrabbitPersistenceManagerTest.java:85)
>
>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>      at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>
>      at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>
>      at java.lang.reflect.Method.invoke(Method.java:597)
>
>      at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.
> java:44)
>
>      at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.j
> ava:15)
>
>      at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.ja
> va:41)
>
>      at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.jav
> a:20)
>
>      at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
> )
>
>      at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>
>      at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
> a:73)
>
>      at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
> a:46)
>
>      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>
>      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>
>      at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>
>      at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
> )
>
>      at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>
>      at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>
>      at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRef
> erence.java:45)
>
>      at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> 8)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:460)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:673)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> java:386)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> .java:196)
>
> Caused by: javax.jcr.nodetype.ConstraintViolationException: no matching
> child node definition found for {}importxml
>
>      at
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicableChildNode
> Def(EffectiveNodeType.java:730)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.getApplicableChildNodeDefinition(NodeImp
> l.java:873)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:759)
>
>      ... 29 more
>
> javax.jcr.nodetype.ConstraintViolationException: no matching child node
> definition found for {}importxml
>
>      at
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicableChildNode
> Def(EffectiveNodeType.java:730)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.getApplicableChildNodeDefinition(NodeImp
> l.java:873)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:759)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:729)
>
>      at
> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:677)
>
>      at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:2110)
>
>      at
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManager.addDef
> initions(JackrabbitPersistenceManager.java:264)
>
>      at
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManagerTest.ad
> dDefintionsTest(JackrabbitPersistenceManagerTest.java:85)
>
>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>      at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>
>      at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>
>      at java.lang.reflect.Method.invoke(Method.java:597)
>
>      at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.
> java:44)
>
>      at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.j
> ava:15)
>
>      at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.ja
> va:41)
>
>      at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.jav
> a:20)
>
>      at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
> )
>
>      at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>
>      at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
> a:73)
>
>      at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
> a:46)
>
>      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>
>      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>
>      at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>
>      at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
> )
>
>      at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>
>      at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>
>      at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRef
> erence.java:45)
>
>      at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
> 8)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:460)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
> nner.java:673)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
> java:386)
>
>      at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
> .java:196)
>
>
>
> I created the doczuments node using the following code:
>
>
>
> rootNode.addNode("definitions", "nt:folder");
>
>
>
> I think my problem must be some really simple problem. Unfortunately I have
> tried figuring this out with google for quite some time now.
>
>
>
> Chris
>
>
>
>
>
>

Mime
View raw message