cancel
Showing results for 
Search instead for 
Did you mean: 

Content model will not enable

srowsell
Champ in-the-making
Champ in-the-making
I'm trying to get this model to go active:

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0
   ../../../../webapps/alfresco/WEB-INF/classes/alfresco/model/modelSchema.xsd"
   name="SCap:model">
   <description>SC AP Model</description>
   <author>Steve Rowsell</author>
   <version>1.0</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="sc.ap.model" prefix="SCap" />
   </namespaces>
   <types>
     <type name="SCap:bundle">
         <title>SC Cheque Stub</title>
         <parent>cm:content</parent>
         <properties>
         <property name="SCap:chequeNo">
               <title>Cheque Number</title>
               <description>Cheque Number</description>
               <type>d:text</type>
           
            </property>
         <property name="SCap:chequeDate">
               <title>Cheque Date</title>
               <description>Cheque Date</description>
               <type>d:date</type>
           
            </property>
         <property name="SCap:vendorNo">
               <title>Vendor Number</title>
               <description>Vendor Number</description>
               <type>d:text</type>
           
            </property>
         <property name="SCap:invoiceDate">
               <title>Expiration Date</title>
               <description>Expiration Date</description>
               <type>d:date</type>
            <multiple>true</multiple>
           
            </property>
         <property name="SCap:invoiceNo">
               <title>Invoice Number</title>
               <description>Invoice Number</description>
               <type>d:text</type>
            <multiple>true</multiple>
           
            </property>
         <property name="SCap:invoiceAmount">
               <title>Invoice Amount</title>
               <description>Invoice Amount</description>
               <type>d:text</type>
            <multiple>true</multiple>
           
            </property>
         <property name="SCap:voucher">
               <title>Voucher Number</title>
               <description>Voucher Number</description>
               <type>d:text</type>
            <multiple>true</multiple>
           
            </property>
         </properties>
      <mandatory-aspects>
            <aspect></aspect>
        </mandatory-aspects>
      </type>
   </types>


   <aspects>
   </aspects>


</model>


And it fails.  I get the following exception in the alfresco.log:
09:24:19,169 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 07160123 Failed to compile model SCap:model
org.alfresco.service.cmr.dictionary.DictionaryException: 07160123 Failed to compile model SCap:model
   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.DictionaryModelType$DictionaryModelTypeTransactionListener$2.doWork(DictionaryModelType.java:672)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:529)
   at org.alfresco.repo.dictionary.DictionaryModelType$DictionaryModelTypeTransactionListener.beforeCommit(DictionaryModelType.java:619)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:747)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:727)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:687)
   at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
   at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:410)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:479)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:517)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:316)
   at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
   at java.lang.Thread.run(Thread.java:722)
Caused by: org.alfresco.service.namespace.InvalidQNameException: A QName must consist of a local name
   at org.alfresco.service.namespace.QName.createQName(QName.java:84)
   at org.alfresco.service.namespace.QName.createQName(QName.java:121)
   at org.alfresco.repo.dictionary.M2ClassDefinition.<init>(M2ClassDefinition.java:177)
   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)
   … 39 more


The relevant part appears to be the "A QName must consist of a local name", but I can't see how my model doesn't conform.

Anyone have any suggestions?
6 REPLIES 6

rjohnson
Star Contributor
Star Contributor
I have never tried a namespace like the one you are creating, my namespaces are always like


<namespace uri="http://www.alfresco.org/model/sc/ap/1.0" prefix="SCap" />


and I have had no problems, so you might try that.

srowsell
Champ in-the-making
Champ in-the-making
I have other models which have similar namespaces, but don't give me errors.  Nevertheless I have tried your value, cleaned things up a little, and now have this:

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 ../../../../webapps/alfresco/WEB-INF/classes/alfresco/model/modelSchema.xsd" name="SCap:model">
   <description>SC AP Model</description>
   <author>Steve Rowsell</author>
   <version>1.0</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="http://www.alfresco.org/model/sc/ap/1.0" prefix="SCap" />
   </namespaces>
   <types>
      <type name="SCap:bundle">
         <title>SC Cheque Stub</title>
         <parent>cm:content</parent>
         <properties>
            <property name="SCap:chequeNo">
               <title>Cheque Number</title>
               <description>Cheque Number</description>
               <type>d:text</type>
            </property>
            <property name="SCap:chequeDate">
               <title>Cheque Date</title>
               <description>Cheque Date</description>
               <type>d:date</type>
            </property>
            <property name="SCap:vendorNo">
               <title>Vendor Number</title>
               <description>Vendor Number</description>
               <type>d:text</type>
            </property>
            <property name="SCap:invoiceDate">
               <title>Expiration Date</title>
               <description>Expiration Date</description>
               <type>d:date</type>
               <multiple>true</multiple>
            </property>
            <property name="SCap:invoiceNo">
               <title>Invoice Number</title>
               <description>Invoice Number</description>
               <type>d:text</type>
               <multiple>true</multiple>
            </property>
            <property name="SCap:invoiceAmount">
               <title>Invoice Amount</title>
               <description>Invoice Amount</description>
               <type>d:text</type>
               <multiple>true</multiple>
            </property>
            <property name="SCap:voucher">
               <title>Voucher Number</title>
               <description>Voucher Number</description>
               <type>d:text</type>
               <multiple>true</multiple>
            </property>
         </properties>
      </type>
   </types>
</model>


And I get the following error in the alfresco.log when I try to make this model active in the Data Dictionary:

14:22:17,525 WARN  [org.alfresco.repo.dictionary.DictionaryDAO] org.alfresco.service.cmr.dictionary.DictionaryException: 07160095 Model '{http://www.alfresco.org/model/sc/ap/1.0}model' does not exist
14:22:18,525 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: The CMIS type model should ignore aspects that inherit from excluded aspects
java.lang.IllegalStateException: The CMIS type model should ignore aspects that inherit from excluded aspects
   at org.alfresco.opencmis.dictionary.PolicyTypeDefintionWrapper.<init>(PolicyTypeDefintionWrapper.java:72)
   at org.alfresco.opencmis.dictionary.CMISStrictDictionaryService.createTypeDefs(CMISStrictDictionaryService.java:78)
   at org.alfresco.opencmis.dictionary.CMISStrictDictionaryService.createDefinitions(CMISStrictDictionaryService.java:46)
   at org.alfresco.opencmis.dictionary.CMISAbstractDictionaryService.init(CMISAbstractDictionaryService.java:386)
   at org.alfresco.opencmis.dictionary.CMISAbstractDictionaryService.afterDictionaryInit(CMISAbstractDictionaryService.java:440)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.initDictionaryRegistry(DictionaryDAOImpl.java:274)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.access$000(DictionaryDAOImpl.java:58)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl$1.doWork(DictionaryDAOImpl.java:214)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl$1.doWork(DictionaryDAOImpl.java:209)


My google-fu on this exception is not proving helpful. 

rjohnson
Star Contributor
Star Contributor
I think the issue is the "model" node

Should it not read


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


Mine would

srowsell
Champ in-the-making
Champ in-the-making
@rjohnson, yes, this adjustment helps.  It's strange, since I just basically recycled the other properties from that element from another model (which works), but it's working now, thanks.

kaynezhang
World-Class Innovator
World-Class Innovator
Your model should have an unique name just as rjohnson said.

kamielvdz
Champ in-the-making
Champ in-the-making
It says the model does not exist, so likely you are referencing to this model in another model, but the order in which they are loaded is not correct. You should put themin the correct order or manage this by adding dependencies when loading the model.

E.g.

<bean id="my.extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="scap.extension.dictionaryBootstrap">


If you use multiple modules make sure that the dependency between these are correct.