cancel
Showing results for 
Search instead for 
Did you mean: 

Error while adding properties filed in ContentType

bisana
Champ on-the-rise
Champ on-the-rise
HI
I am  referring the document link
http://wiki.alfresco.com/wiki/Data_Dictionary_Guide
My intention to to  create property for Content type, I have cut and pasted the code which I am referring

 
<type name="cm:cmobject">
         <title>Object</title>
         <parent>sys:base</parent>
         <properties>
            <property name="cm:name">
               <type>d:text</type>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>cm:auditable</aspect>
         </mandatory-aspects>
      </type>

This above code throws me error such as
2012-04-19 14:04:23,172  ERROR [web.context.ContextLoader] [main] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'example.dictionaryBootstrap' defined in file [/opt/legaldm/tomcat/shared/classes/alfresco/extension/agg-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 03190002 Could not import bootstrap model alfresco/extension/aggModel.xml
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:5

When I remark properties tag, and run alfresco I don't get error
Why cant I include the properties tag in the ContentType definition
Has any one faced this problem
Guidance and advice requested
Thanks
Joseph John
6 REPLIES 6

mitpatoliya
Star Collaborator
Star Collaborator
It is because you are trying to override property which is defined in the OOTB content model.
so try with some other property name like cm:customprop

bisana
Champ on-the-rise
Champ on-the-rise
Thans Mits for the reply
I changed it and tried, it did not work, still I get error

mitpatoliya
Star Collaborator
Star Collaborator
Make sure your model file is valid xml file.
Also replace the cm:cmobject with some cm:customobject and parent as cm:content rather then sys:base.
Also compare your file with the OOTB model file contentmodel.xml file and make sure you are not missing any tags like <types> and all.
Also you log the error which you are getting in the post in case it is still not working.

bisana
Champ on-the-rise
Champ on-the-rise
Thanks Mit
It is not working, it works when I comment the properties tag from "types" in  my "aggModel.xml"
I am adding my aggModel.xml and agg-model-context.xml
Code of my aggModel.xml is

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Someco Model</description>
<author>Jeff Potts</author>
<version>1.0</version>

<!– Imports are required to allow references to definitions in other models –>
<imports>
<!– Import Alfresco Dictionary Definitions –>
<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" />
</imports>
<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.someco.com/model/content/1.0" prefix="sc" />
</namespaces>


<types>
<!– Enterprise-wide generic document type –>
<type name="sc:doc">
<title>Someco Document</title>
<parent>cm:content</parent>

<associations>
<association name="sc:relatedDocuments">
<title>Related Documents</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sc:doc</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>

<properties>
<property name="sc:product">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="sc:version">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>

<mandatory-aspects>
<aspect>cm:generalclassifiable</aspect>
</mandatory-aspects>
</type>

</model>




and code of my agg-model-context.xml is

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!– Registration of new models –>
<bean id="someco.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/aggModel.xml</value>
</list>
</property>
</bean>
</beans>

and error which I am getting when I enable "property " tag is that
ERROR [web.context.ContextLoader] [main] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someco.dictionaryBootstrap' defined in file [/opt/legaldm/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension/agg-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 03220001 Could not import bootstrap model alfresco/extension/aggModel.xml
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java

I am wondering why I get error only when I enable "properties" tag, not when I disable / remove the property tag
Guidance, Advice requested
Thanks
Joseph John

bisana
Champ on-the-rise
Champ on-the-rise
Hi All
big THANKS to all who had given advice, I was able to solve the issue, Now when I  start the alfresco service I am not getting error. The reason was that there was some tag problems in my  "xxxModel.xml"
I am posting here the correct one which works

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="sc:somecomodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Someco Model</description>
<author>Jeff Potts</author>
<version>1.0</version>

<!– Imports are required to allow references to definitions in other models –>
<imports>
<!– Import Alfresco Dictionary Definitions –>
<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" />
</imports>
<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.someco.com/model/content/1.0" prefix="sc" />
</namespaces>


<types>
<!– Enterprise-wide generic document type –>

<type name="sc:doc">
<title>Someco Document</title>
<parent>cm:content</parent>

<properties>
<property name="sc:product">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="sc:version">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>

<associations>
<association name="sc:relatedDocuments">
<title>Related Documents</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sc:doc</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>



<mandatory-aspects>
<aspect>cm:generalclassifiable</aspect>
</mandatory-aspects>
</type>


     
</types>
</model>

mitpatoliya
Star Collaborator
Star Collaborator
Great.
Please mark it as solved.