【问题标题】:Alfresco: how to override a (corrupt) dynamic content model with a bootstrapped one?Alfresco:如何用自举模型覆盖(损坏的)动态内容模型?
【发布时间】:2016-01-20 04:54:02
【问题描述】:

部署并激活了 Alfresco (5.0.d CE) 的损坏的动态内容模型

我所说的损坏是指内容模型无效,因为使用了不存在的错误类型。比如:

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

“测试”显然无效 - 但模型中的错误在这里并不重要。

所以,这个内容模型被动态部署到了

Repository > Data Dictionary > Models 

然后不幸的是通过 Alfresco API 调用激活(而不是通过 Share UI;因为 Share UI 通常在实际允许激活之前检查模型是否有效)。

这会导致 Alfresco 存储库不再启动,但失败并出现错误:

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

在启动时。

我现在的问题是如何在无法访问正在运行的 Alfresco 存储库实例的情况下再次停用这个损坏的模型,这不再能够访问 Data Dictionary > Models 文件夹。

我已经尝试在 /alfresco/tomcat/shared/classes/alfresco/extension 文件夹中部署具有相同模型名称的 customModel.xml 和 custom-model-context.xml 等,但这似乎并没有覆盖动态模型。 启动 Alfresco 时,我仍然收到上述错误。

有什么想法吗?谢谢!

仅供参考,这是我用来覆盖旧文件的更正后的虚拟 customModel.xml 文件,它只是与损坏的文件具有相同的模型名称:

<?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>

【问题讨论】:

    标签: alfresco data-modeling


    【解决方案1】:

    部署到数据字典的任何模型都作为原始 XML 文件存储在内容存储中。在这种情况下,最简单的解决方案是找到该 XML 文件并使用您列出的更正模型更新其内容。 您应该能够通过对 alf_node、alf_qname、alf_node_properties、alf_content_data 和 alf_content_url 表执行数据库查询来轻松识别任何模型文件,即执行这样的查询

    select alf_content_url.content_url
    from alf_node
        left join alf_qname on alf_node.type_qname_id = alf_qname.id
        left join alf_node_properties on alf_node_properties.node_id = alf_node.id
        join alf_content_data on alf_content_data.id = alf_node_properties.long_value
        left join alf_content_url on alf_content_url.id = alf_content_data.content_url_id
    where
        alf_qname.local_name = 'dictionaryModel'
        and alf_content_url.content_url is not null
    

    修正模型后,重新启动应该可以正常工作,因为只有 QName 实际存储在数据库中,但其他所有内容总是从 XML 文件(类路径或内容存储)重新加载。

    【讨论】:

    • 嗯,是的,你是对的,文件存储为原始 xml ......我现在想起来了。我想我之前有点困惑,因为奇怪的是我实际上对整个 alf_data 进行了全文搜索,发现的只是 alf_data/solr/models 下的一个文件,但 alf_data/contentstore/ 下没有一个文件。但是我用 Pathfinder 在我的 Mac 上进行了搜索——我认为它没有正确搜索/处理扩展名为 .bin 的文件或跳过它,不知道。应该用 grep 完成。
    【解决方案2】:

    我认为您可以执行 grep 来搜索文件系统中的文件。现在太晚了……

    【讨论】:

    • 嗯,是的,你是对的,文件存储为原始 xml ......我现在想起来了。我想我之前有点困惑,因为奇怪的是我实际上对整个 alf_data 进行了全文搜索,发现的只是 alf_data/solr/models 下的一个文件,但 alf_data/contentstore/ 下没有一个文件。但是我用 Pathfinder 在我的 Mac 上进行了搜索——我认为它没有正确搜索/处理扩展名为 .bin 的文件或跳过它,不知道。应该用 grep 完成。
    【解决方案3】:

    我现在的解决方案是删除 /alf_data/contentstore/ 的部分内容(我大致知道模型的部署时间)。由于它都是 .bin 格式,我不确定我还删除了哪些其他文件,但它并没有太多;-) 之后,Alfresco 至少又开始了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-13
      • 1970-01-01
      • 1970-01-01
      • 2021-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多