cancel
Showing results for 
Search instead for 
Did you mean: 

How to override a (corrupt) dynamic content model with a bootstrapped one?

mathias_lin
Star Contributor
Star Contributor
A <strong>corrupt dynamic content model</strong> to Alfresco (5.0.d CE) was deployed and activated.

By corrupt I mean, the content model is not valid, because a wrong type has been used which does not exist. Something like:


<property name="my:name">
    <type>test</type>
</property>


where "test" is obviously not valid - but the mistake in the model does not really matter here.

So, this content model was deployed dynamically to the

Repository > Data Dictionary > Models

and then unfortunately <strong>activated via Alfresco API call</strong> (and not via Share UI; since the Share UI usually checks if a model is valid before actually allowing to activate it).

This causes the Alfresco repository to not start anymore but fail with the error:


2016-01-19 18:17:11,780 ERROR [org.springframework.web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.alfresco.service.namespace.NamespaceException: A namespace prefix is not registered for uri my.test.model
on booting up.


My question is now, <strong>how to deactivate this corrupt model again</strong> without having access to the running Alfresco repository instance, this not able to access the Data Dictionary > Models folder anymore.

<strong>I already tried to deploy a customModel.xml and custom-model-context.xml with the same model name</strong> etc. inside to the /alfresco/tomcat/shared/classes/alfresco/extension folder, but this does not seem to override the dynamic model. When booting up Alfresco, I still get the error above.

Any ideas anybody? Thanks!

Just for reference, this is the customModel.xml file that I use to override the old one:


<?xml version="1.0" encoding="UTF-8"?>

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

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

   <!– Optional meta-data about the model –>
   <description>Custom Model</description>
   <author></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 –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="my.test.model" prefix="my"/>
   </namespaces>

</model>


<hr/>
<strong>UPDATE:</strong>
A useful answer has been provided on StackOverflow: http://stackoverflow.com/questions/34883278/alfresco-how-to-override-a-corrupt-dynamic-content-model...
1 REPLY 1

mathias_lin
Star Contributor
Star Contributor
My solution for now was to delete parts of the /alf_data/contentstore/ (I roughly knew at what time the model has been deployed). Since it's all in .bin format, I'm not sure what other files I deleted as well, but it weren't too many 😉
Afterwards, Alfresco at least starts again.