AnsweredAssumed Answered

Exception in custom model

Question asked by akudinov on Oct 17, 2010
Latest reply on Oct 17, 2010 by akudinov
Good day,

I have a configuration with two custom types, that defined in two separate files:
1). fdline-contract-model.xml
2). fdline-inputdoc-model.xml
They loaded in context with fdline-model-context.xml
When I started alfresco I see in tomcat console:

04:16:17,939  ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' d
efined in file [C:\Alfresco\tomcat\shared\classes\alfresco\extension\fdline-model-context.xml]: Invocation of init metho
d failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 09170002 Could not import bootstr
ap model alfresco/extension/fdline-contract-model.xml
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1401)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:512)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:450)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListable
BeanFactory.java:557)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplic
ationContext.java:842)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:519)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 09170002 Could not import bootstrap model alfresco/e
xtension/fdline-contract-model.xml
        at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:157)
        at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:104)
        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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractA
utowireCapableBeanFactory.java:1529)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi
reCapableBeanFactory.java:1468)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1398)
        … 37 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 09170001 Failed to compile model FDLineContract:fdli
ne-contract-model
        at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:106)
        at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:128)
        at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:277)
        at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:153)
        … 45 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 09170000 d_dictionary.model.err.duplicate_constraint
_on_model
        at org.alfresco.repo.dictionary.M2PropertyDefinition.buildConstraints(M2PropertyDefinition.java:135)
        at org.alfresco.repo.dictionary.M2PropertyDefinition.resolveDependencies(M2PropertyDefinition.java:108)
        at org.alfresco.repo.dictionary.M2ClassDefinition.resolveDependencies(M2ClassDefinition.java:198)
        at org.alfresco.repo.dictionary.CompiledModel.resolveDependencies(CompiledModel.java:230)
        at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:92)
        … 48 more
Source of fdline-contract-model.xml :

<?xml version="1.0" encoding="utf-8"?>
<model name="FDLineContract:fdline-contract-model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <!–Optional meta-data about the model–>
    <description>fdline documents Model</description>
    <author />
    <version>1.0</version>
    <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="FDLineContract.fdline-contract-model" prefix="FDLineContract" />
    </namespaces>
    <!–Definition of new constraints–>
    <constraints>
   
   <constraint name="FDLineContract:Client"  type="ru.fdline.alfresco.extensions.dict.constraints.DictionaryBasedListConstraint" >
       <parameter name="table"><value>Client</value></parameter>
       <parameter name="caseSensitive"><value>true</value></parameter>
       <parameter name="allowedValues">
       <list>
       </list>
       </parameter>
   </constraint>
   
   <constraint name="FDLineContract:Employer"
         type="ru.fdline.alfresco.extensions.dict.constraints.DictionaryBasedListConstraint">
         <parameter name="table"><value>Employer</value></parameter>
         <parameter name="caseSensitive"><value>true</value></parameter>
         <parameter name="allowedValues">
            <list>
            </list>
         </parameter>
   </constraint>
   
   <constraint name="FDLineContract:Status" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Test</value>
            </list>
         </parameter>
      </constraint>
    </constraints>
    <types>
      <type name="FDLineContract:model">
         <title>Договор</title>
         <parent>cm:content</parent>
         <properties>
            <property name="FDLineContract:number">
               <title>Номер</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="FDLineContract:date">
               <title>Дата заключения договора</title>
               <type>d:date</type>
               <mandatory>true</mandatory>
            </property>
            <property name="FDLineContract:customer">
               <title>Заказчик</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <constraints>
                  <constraint name="FDLineContract:Client" />
               </constraints>
            </property>
            <property name="FDLineContract:summa">
               <title>Сумма вознаграждения</title>
               <type>d:double</type>
               <mandatory>true</mandatory>
            </property>

            <property name="FDLineContract:employer">
               <title>Исполнитель</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <!–constraints>
                  <constraint name="FDLineContract:Employers" />
               </constraints–>
            </property>
            <property name="FDLineContract:status">
               <title>Статус</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <constraints>
                  <constraint name="FDLineContract:Status" />
               </constraints>
            </property>
         </properties>
      </type>
    </types>
</model>

What is org.alfresco.service.cmr.dictionary.DictionaryException: 09170000 d_dictionary.model.err.duplicate_constraint
_on_model and how can I solve this problem.

Thank you

Outcomes