Getting Error on creating Custom Model

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member

Getting Error on creating Custom Model

Hi

Actually i am working with sample project as i am new to alfresco, referring the alfresco documentation, added new custom content model in bootstrap-context.xml and created the custom model in model folder, default content-model is already there and heven't  touched it. and also  added properties file in messages folder, and after added the same in share-config-custom.xml file. when i run the project iam getting the following error, 

2017-12-05 08:57:02,985 WARN [org.springframework.web.context.support.XmlWebApplicationContext] [localhost-startStop-1] Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DigiGov-repo-amp.dictionaryBootstrap' defined in class path resource [alfresco/module/DigiGov-repo-amp/context/bootstrap-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 11050001 Could not import bootstrap model 'alfresco/module/DigiGov-repo-amp/model/dg-model.xml'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11050001 Could not import bootstrap model 'alfresco/module/DigiGov-repo-amp/model/dg-model.xml'
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:173)
at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
... 22 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11050000 Failed to compile model 'dg:dgModel'
at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:116)
at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:167)
at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModelImpl(DictionaryDAOImpl.java:273)
at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:260)
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:169)
... 30 more
Caused by: org.alfresco.service.namespace.NamespaceException: Namespace prefix hxa is not mapped to a namespace URI
at org.alfresco.service.namespace.QName.createQName(QName.java:102)
at org.alfresco.service.namespace.QName.createQName(QName.java:124)
at org.alfresco.repo.dictionary.M2ClassDefinition.<init>(M2ClassDefinition.java:107)
at org.alfresco.repo.dictionary.M2TypeDefinition.<init>(M2TypeDefinition.java:42)
at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:157)
at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:96)
... 34 more
2017-12-05 08:57:03,204 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'solrSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,207 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'activitiesSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,772 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'locksSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,774 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'propertyValueSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,774 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'auditSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,775 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'contentSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,776 WARN [org.springframework.beans.factory.support.DisposableBeanAdapter] [localhost-startStop-1] Invocation of destroy method 'close' failed on bean with name 'repoSqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
2017-12-05 08:57:03,788 ERROR [org.springframework.web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DigiGov-repo-amp.dictionaryBootstrap' defined in class path resource [alfresco/module/DigiGov-repo-amp/context/bootstrap-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 11050001 Could not import bootstrap model 'alfresco/module/DigiGov-repo-amp/model/dg-model.xml'
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11050001 Could not import bootstrap model 'alfresco/module/DigiGov-repo-amp/model/dg-model.xml'
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:173)
at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
... 22 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11050000 Failed to compile model 'dg:dgModel'
at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:116)
at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:167)
at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModelImpl(DictionaryDAOImpl.java:273)
at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:260)
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:169)
... 30 more
Caused by: org.alfresco.service.namespace.NamespaceException: Namespace prefix hxa is not mapped to a namespace URI
at org.alfresco.service.namespace.QName.createQName(QName.java:102)
at org.alfresco.service.namespace.QName.createQName(QName.java:124)
at org.alfresco.repo.dictionary.M2ClassDefinition.<init>(M2ClassDefinition.java:107)
at org.alfresco.repo.dictionary.M2TypeDefinition.<init>(M2TypeDefinition.java:42)
at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:157)
at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:96)
... 34 more

Any solution to resolve? Thanks in Advance

7 Replies
Senior Member

Re: Getting Error on creating Custom Model

Hi Noohul Althaf,

Error indicates that your prefix is not mapped with your namespace URI.

Try using unique prefix and namespace URI for your content model.

Or please provide your model.xml file to help you out.

Thanks,

Kalpesh

ContCentric

Active Member

Re: Getting Error on creating Custom Model

Hi Kalpesh,

Thanks for your Reply.

As i checked the prefix and it seems unique with namespace URI, here i am pasting code of my model file, please check whats wrong in that.

<--hexaModel.xml-->

<?xml version="1.0" encoding="UTF-8"?>
<model name="hxa:hexaModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<!-- Optional meta-data about the model -->
<description>Model for Hexa</description>
<author>Hexa</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"/>
<!-- Import Alfresco System Model Definitions -->
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>

<!-- Custom namespace for your domain -->
<namespaces>
<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="hxa"/>
</namespaces>

<!-- ===============================================================================================================
Constraints, Types, and Aspects go here...
-->


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

<type name="hxa:employeeDoc">
<title>Employee Document</title>
<parent>hxa:doc</parent>

<associations>
<association name="hxa:relatedDoc">
<title>Related Documents</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>hxa:legalDoc</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
</types>

<aspects>
<aspect name="hxa:status">
<title>DigGov Article Status</title>
<properties>
<property name="hxa:createdOn">
<type>d:date</type>
</property>
<property name="hxa:isActive">
<type>d:boolean</type>
<default>false</default>
</property>
<property name="hxa:isPublished">
<type>d:date</type>
</property>
</properties>
</aspect>
</aspects>

</model>

<---bootstrap-context.xml-->

<bean id="DigiGov-repo-amp.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/module/${project.artifactId}/model/dg-model.xml</value>
<value>alfresco/module/${project.artifactId}/model/workflow-model.xml</value>
<value>alfresco/module/${project.artifactId}/model/hexaModel.xml</value>
</list>
</property>

<property name="labels">
<list>
<value>alfresco/module/${project.artifactId}/messages/dgModel</value>

<value>alfresco/module/${project.artifactId}/messages/hexaModel</value> 
</list>
</property>
</bean>

Senior Member II

Re: Getting Error on creating Custom Model

You have added content of hexaModel.xml.While error is in dg-model.xml.Please put the content of that file.

Active Member

Re: Getting Error on creating Custom Model

Actually dg-model.xml was already there and project runs successfully, but when i add hexaModel.xml custom model, got error.anyhow i am adding the content of dg-model.please have a look.

<?xml version="1.0" encoding="UTF-8"?>
<model name="dg:dgModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<!-- Optional meta-data about the model -->
<description>Model for DigGov</description>
<author>Hexa</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"/>
<!-- Import Alfresco System Model Definitions -->
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>

<!-- Custom namespace for your domain -->
<namespaces>
<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="dg"/>
</namespaces>

<!-- ===============================================================================================================
Constraints, Types, and Aspects go here...
-->
<constraints>
<constraint name="dg:defectiveList" type="LIST">
<parameter name="allowedValues">
<list>
<value>Voting Device Uno</value>
<value>Voting Device Dos</value>
</list>
</parameter>
</constraint>
</constraints>

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

<type name="dg:legalDoc">
<title>DigGov Legal Document</title>
<parent>dg:doc</parent>
<!-- <properties>
<property name="dg:lawDenied">
<type>d:boolean</type>
<default>false</default>
</property>
</properties> -->
<associations>
<association name="dg:relatedDoc">
<title>Related Documents</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>dg:legalDoc</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>

<type name="dg:sectionDoc">
<title>DigGov Section Doc</title>
<parent>dg:legalDoc</parent>
<properties>
<property name="dg:votingDevices">
<type>d:text</type>
<multiple>true</multiple>
<constraints>
<constraint ref="dg:defectiveList" />
</constraints>
</property>
</properties>
<mandatory-aspects>
<aspect>cm:replaceable</aspect>
</mandatory-aspects>
</type>

<type name="dg:voteBill">
<title>Bill Passing</title>
<parent>cm:content</parent>
</type>


</types>

<aspects>
<aspect name="dg:articleStatus">
<title>DigGov Article Status</title>
<properties>
<property name="dg:createdOn">
<type>d:date</type>
</property>
<property name="dg:isActive">
<type>d:boolean</type>
<default>false</default>
</property>
<property name="dg:isPublished">
<type>d:date</type>
</property>
</properties>
</aspect>

<!-- Ocr -->
<aspect name="dgSmiley Surprisedcrd">
<title>OCRd</title>
<properties>
<property name="dgSmiley TonguerocessedDate">
<title>OCR process date</title>
<type>d:datetime</type>
</property>
</properties>
</aspect>

<aspect name="dg:votable">
<title>Law ready to vote?</title>

<properties>
<property name="dg:lawDenied">
<type>d:boolean</type>
<default>false</default>
</property>
</properties>

<!-- <associations>
<child-association name="dg:assoVote">
<title>Rating</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>dg:voteBill</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</child-association>
</associations> -->
</aspect>

<aspect name="dg:metaData">
<title>DigGov Doc Metadata</title>
<properties>
<property name="dg:author">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</aspect>

</aspects>

</model>

Advanced II

Re: Getting Error on creating Custom Model

You have used the same namespace uri for both models, with different prefixes:

<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="hxa"/>

<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="dg"/>

Those should be unique.

Active Member

Re: Getting Error on creating Custom Model

So if we use multiple content model for different companies, we can use different namespace uri and prefix right? 

here i deleted other models defined in bootstrap.xml file and only one model is active now, but whenever i am running the project, the code changes are not getting reflected and it is running the old existing codes and giving the same error, any commands have to apply after trhe code changes in project to get the new updates?

Senior Member II

Re: Getting Error on creating Custom Model

MAke sure you are not uploading the file which is inside target folder of maven.