cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot determine child association for node type

amit_wmw
Champ in-the-making
Champ in-the-making
Hello,

I am using alfresco2.1 and I have created a custom content type as below.

<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">



<!– Optional meta-data about the model –>
<description>Someco Model</description>
<author>Optaros</author>
<version>1.0</version>

<imports>
     
     <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!– Import Alfresco Content Domain Model Definitions –>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>


<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.alfresco.org/model/content1/1.0" prefix="sc"/>

</namespaces>


<types>
<type name="sc:scobject">
         <title>Object</title>
         <parent>sys:base</parent>
      
       
      </type>
     
      <type name="sc:folder">
         <title>Folder</title>
         <parent>sc:scobject</parent>
         <archive>true</archive>
         <associations>
            <child-association name="sc:contains">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>sys:base</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
               <duplicate>false</duplicate>
            </child-association>
         </associations>
      </type>

     
   <!– Enterprise-wide generic document type –>
   <type name="sc:doc">
      
      <title>Someco Document</title>
      <properties>
            <property name="sc:name">
               <type>d:text</type>
            </property>
         </properties>   
   </type>
</types>


</model>

But while executing my code I am getting below error message.

error while creating nodes javax.jcr.RepositoryException: Cannot determine child association for node type '{http://www.alfresco.org/model/content1/1.0}doc within parent workspace://SpacesStore/88ad434d-2037-11de-914e-f311c9e69274: Cannot determine child association for node type '{http://www.alfresco.org/model/content1/1.0}doc within parent workspace://SpacesStore/88ad434d-2037-11de-914e-f311c9e69274
javax.jcr.RepositoryException: Cannot determine child association for node type '{http://www.alfresco.org/model/content1/1.0}doc within parent workspace://SpacesStore/88ad434d-2037-11de-914e-f311c9e69274: Cannot determine child association for node type '{http://www.alfresco.org/model/content1/1.0}doc within parent workspace://SpacesStore/88ad434d-2037-11de-914e-f311c9e69274
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:175)
   at $Proxy86.addNode(Unknown Source)
   at org.hcl.grcmip.workflow.document.jcr.impl.JCRTemplateImpl.save(JCRTemplateImpl.java:64)
   at org.hcl.grcmip.workflow.document.vo.impl.Main.main(Main.java:30)
Caused by: org.alfresco.error.AlfrescoRuntimeException: Cannot determine child association for node type '{http://www.alfresco.org/model/content1/1.0}doc within parent workspace://SpacesStore/88ad434d-2037-11de-914e-f311c9e69274
   at org.alfresco.jcr.item.NodeImpl.getNodeTypeChildAssocDefForParent(NodeImpl.java:258)
   at org.alfresco.jcr.item.NodeImpl.addNode(NodeImpl.java:189)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:138)
   … 3 more
org.alfresco.error.AlfrescoRuntimeException: Cannot determine child association for node type '{http://www.alfresco.org/model/content1/1.0}doc within parent workspace://SpacesStore/88ad434d-2037-11de-914e-f311c9e69274
   at org.alfresco.jcr.item.NodeImpl.getNodeTypeChildAssocDefForParent(NodeImpl.java:258)
   at org.alfresco.jcr.item.NodeImpl.addNode(NodeImpl.java:189)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:138)
   at $Proxy86.addNode(Unknown Source)
   at org.hcl.grcmip.workflow.document.jcr.impl.JCRTemplateImpl.save(JCRTemplateImpl.java:64)
   at org.hcl.grcmip.workflow.document.vo.impl.Main.main(Main.java:30)

Kindly suggest what can be done to resolve this error.

Thanks
Amit.
1 REPLY 1

amit_wmw
Champ in-the-making
Champ in-the-making
Hello

By doing below modifications in my custom content model, now I can able to execute my code without below mentioned error.

<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">



<!– Optional meta-data about the model –>
<description>Someco Model</description>
<author>Optaros</author>
<version>1.0</version>

<imports>
     
     <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!– Import Alfresco Content Domain Model Definitions –>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>


<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.alfresco.org/model/content1/1.0" prefix="sc"/>

</namespaces>


<types>
<type name="sc:scobject">
         <title>Object</title>
         <parent>sys:base</parent>
      
       
      </type>
     
     

     
   <!– Enterprise-wide generic document type –>
   <type name="sc:doc">
      <title>Folder</title>
         <parent>sc:scobject</parent>
         <archive>true</archive>

       <properties>
            <property name="sc:name">
               <type>d:text</type>
            </property>
        

      
            <property name="sc:description">
               <type>d:text</type>
            </property>
        

      
            <property name="sc:title">
               <type>d:text</type>
            </property>
         </properties>

         <associations>
            <child-association name="sc:contains">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>sys:base</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
               <duplicate>false</duplicate>
            </child-association>
         </associations>
      
        
   </type>
</types>


</model>

I can find contents getting created under alf_data directory as well but the strange thing for me is I am unable to view created node/content under company_home(when I start server and login to alfresco console)!! If I create content using "cm:" I can view the content under company_home but with my custom model "sc:" I am unable to!!

Will anybody please tell me what can be the cause? And how can I resolve it?

Thanks
Amit.