cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Model - Context initialization failed

michaelq87
Champ in-the-making
Champ in-the-making
Hi,

I'm editing an existing ad working custom model on Alfresco 4.0.

To the old customModel.xml i'm declaring a new constraint and a new type (custom:myADSocietaConstraint and custom:ad). All the other declarations are old, and they were working.



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

   <!– Optional meta-data about the model –>  
   <description>Custom Model</description>
   <author></author>
   <version>1.1</version>

   <imports>
      
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
   
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <namespaces>
      <namespace uri="custom.model" prefix="custom"/>
   </namespaces>
  
   <constraints>
      <!– mail constraint –>
      <constraint name="custom:myPostaConstraint" type="LIST" >
         <parameter name="allowedValues">
            <list>
             <value></value>
            <value>INPUT</value>
            <value>OUTPUT</value>
            </list>
         </parameter>
         <parameter name="caseSensitive">
           <value>false</value>
         </parameter>
      </constraint>
    
     <!– sgr fund constraint –>
     <constraint name="custom:mySGRFondoConstraint" type="LIST" >
         <parameter name="allowedValues">
            <list>
            <value></value>
            <value>Garibaldi</value>
            <value>Anastasia</value>
            <value>Vivaldi</value>
            </list>
         </parameter>
         <parameter name="caseSensitive">
           <value>false</value>
         </parameter>
      </constraint>
     
       <constraint name="custom:myADSocietaConstraint" type="LIST" >
         <parameter name="allowedValues">
            <list>
            <value>Società dummy</value>
            <value>MANAGEMENT S.P.A. </value>
            <value>AGENCY S.P.A.</value>
            <value>COMPANY S.r.l.</value>
            </list>
         </parameter>
         <parameter name="caseSensitive">
           <value>false</value>
         </parameter>
      </constraint>
     
   </constraints>
  
   <types>
     <!– Custom Type definition –>
    
      <type name="custom:sgr">
         <title>SGR Type</title>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:testo">
               <type>d:text</type>
            </property>
         <property name="custom:posta">
               <type>d:text</type>
            <constraints>
                  <constraint ref="custom:myPostaConstraint" />
               </constraints>
            </property>
         <property name="custom:sgrfondo">
               <type>d:text</type>
            <constraints>
                  <constraint ref="custom:mySGRFondoConstraint" />
               </constraints>
            </property>
         <property name="custom:protocollo">
               <type>d:text</type>
            </property>
         <property name="custom:oggetto">
               <type>d:text</type>
            </property>
         <property name="custom:doxarchivio">
               <type>d:text</type>
            </property>
         <property name="custom:mittentedestinatario">
               <type>d:text</type>
            </property>
         </properties>
      </type>
     
      <type name="custom:ad">
         <title>AD Type</title>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:testo">
               <type>d:text</type>
            </property>
         <property name="custom:posta">
               <type>d:text</type>
            <constraints>
                  <constraint ref="custom:myPostaConstraint" />
               </constraints>
            </property>
         <property name="custom:societa">
               <type>d:text</type>
            <constraints>
                  <constraint ref="custom:myADSocietaConstraint" />
               </constraints>
            </property>
         <property name="custom:protocollo">
               <type>d:text</type>
            </property>
         <property name="custom:oggetto">
               <type>d:text</type>
            </property>
         <property name="custom:mittentedestinatariocompany">
               <type>d:text</type>
            </property>
            <property name="custom:mittentedestinatariosoggetto">
               <type>d:text</type>
            </property>
         </properties>
      </type>
     
   </types>
  
</model>




Then on share-config-custom.xml I extended my old config evaluator="string-compare" condition="DocumentLibrary" with the subtype "custom:ad".

<config evaluator="string-compare" condition="DocumentLibrary">
    
     <!– Custom SGR subtype –>
     <types>
      <type name="cm:content">
         <subtype name="custom:sgr" />
         <subtype name="custom:ad" />
      </type>
      
      <type name="cm:folder">
      </type>
     </types>

   </config>


On startup of alfresco i get this error:


2013-01-25 14:15:53,680  ERROR [web.context.ContextLoader] [main] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [/intranet/documentale/nodo1/alfresco-4.0.b/tomcat/shared/classes/alfresco/extension/custom-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 00250002 Could not import bootstrap model alfresco/extension/customModel.xml
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
   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: 00250002 Could not import bootstrap model alfresco/extension/customModel.xml
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:158)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:105)
   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(AbstractAutowireCapableBeanFactory.java:1544)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
   … 37 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 00250001 Failed to compile model custom:customModel
   at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:108)
   at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:163)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModelImpl(DictionaryDAOImpl.java:298)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:281)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:154)
   … 45 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 00250000 Found duplicate property definition custom:testo within class custom:ad and class custom:sgr
   at org.alfresco.repo.dictionary.M2ClassDefinition.<init>(M2ClassDefinition.java:117)
   at org.alfresco.repo.dictionary.M2TypeDefinition.<init>(M2TypeDefinition.java:41)
   at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:149)
   at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:88)
   … 49 more




Can you tell me what's wrong?
2 REPLIES 2

scouil
Star Contributor
Star Contributor
Here's the line you're looking for:
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 00250000 Found duplicate property definition custom:testo within class custom:ad and class custom:sgr


Consider using "aspects" for redundant properties.

mrogers
Star Contributor
Star Contributor
Sorry - see above.   I'm having problems with the new forums.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.