Alfresco 问题:URI 无法导入,因为它未定义(带有前缀

Alfresco Issue: URI cannot be imported as it is not defined (with prefix

我正在将基于 Alfresco 3.2r13 的应用程序从 linux/IntelliJ/Ant 迁移到 Windows/Eclipse。

稍后的目标是将 Maven 添加到 Eclipse 项目中,但现在,我只想让它工作。

目前我面临以下问题:

我将 contentTypesModel.xml 添加到项目中,这里是第一行:

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

<!-- Optional meta-data about the model -->
<description>Example custom Model</description>
<author></author>
<version>1.0</version>

<!-- Imports are required to allow references to definitions in other models -->
<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 uri="http://www.alfresco.org/grimoire/model/ma0189cstr/1.0" prefix="ma0189cstr"/>
    <import uri="http://www.alfresco.org/grimoire/model/ma43110cstr/1.0" prefix="ma43110cstr" />
    <import uri="http://www.alfresco.org/grimoire/model/baremesSys/1.0"
            prefix="baremesSys"/>
    <import uri="http://www.alfresco.org/grimoire/model/baremes/1.0"
            prefix="baremes"/>
    <import
            uri="http://www.alfresco.org/grimoire/model/workflow/baremes/perimetres/1.0"
            prefix="perimetres"/>
</imports>

<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace my.new.model should be changed to reflect
    your own namespace -->
<namespaces>
    <namespace uri="http://www.alfresco.org/grimoire/model/contenttypes/1.0"
               prefix="GPCT"/>
</namespaces>

尝试 运行 Tomcat 服务器时,我收到以下错误跟踪:

> 23 déc. 2015 16:28:44,047  ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [D:\TomcatGrimoire\webapps\GrimoireMk0\WEB-INF\classes\alfresco\extension\gp-models-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 11230001 Could not import bootstrap model alfresco/extension/contentTypesModel.xml
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11230001 Could not import bootstrap model alfresco/extension/contentTypesModel.xml
    at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:150)
    at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:108)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:249)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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: 11230000 Failed to compile model GPCT:gpcontenttypeswfmodel
    at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:112)
    at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:134)
    at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:273)
    at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:146)
    ... 34 more
Caused by: org.alfresco.service.namespace.NamespaceException: URI http://www.alfresco.org/grimoire/model/ma0189cstr/1.0 cannot be imported as it is not defined (with prefix ma0189cstr
    at org.alfresco.repo.dictionary.CompiledModel.createLocalPrefixResolver(CompiledModel.java:209)
    at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:134)
    at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:94)
    ... 37 more

文件 wfMA0189Constraints.xml 包含以下定义:

<!-- Optional meta-data about the model -->
<description>MA0189 Constraints Workflow Model</description>
<author>FSE</author>
<version>1.0</version>

<!-- Imports are required to allow references to definitions in other models -->
<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 -->
<namespaces>
    <namespace uri="http://www.alfresco.org/grimoire/model/ma0189cstr/1.0" prefix="ma0189cstr"/>
</namespaces>

据我了解错误,tomcat 服务器未确认文件内容。问题是在检查 tomcat 构建后确实包含该文件。

所以我陷入了这个错误。欢迎任何帮助。

提前致谢,祝您节日快乐。

可能在扩展路径中部署了一个 spring 上下文文件。 文件名通常以“-context.xml”结尾。 查找包含内容模型文件名称的上下文文件:您应该看到带有 parent="dictionaryModelBootstrap".

的 bean 的定义

如果您找不到这个上下文文件,请尝试在您的源代码中找到它并查看它是如何被 intellij/ant

打包的

请在以下位置找到更多详细信息: http://docs.alfresco.com/5.1/tasks/dev-extensions-content-models-tutorials-deploy-model.html

问题可能是由内容模型的加载顺序引起的。这或许可以解释 IntelliJ 和 Eclipse 之间的区别。

如果您想确定顺序,您可以使用 depends-on 作为 bean 初始化中的一个属性。

如果模型位于不同的模块中,您还可以使用模块依赖项。 参见示例:http://docs.alfresco.com/4.2/concepts/dev-extensions-modules-module-properties.html

您的上下文文件中似乎缺少 "wfMA0189Constraints.xml" 模型文件条目。这就是 Alfresco 无法拾取该模型的原因,因此它将前缀显示为未识别的前缀。

根据您的日志,我发现您正在使用“gp-models-context.xml”作为上下文文件。你能在那里看到这个模型文件 (wfMA0189Constraints.xml) 的条目吗?

如果您确定没有上下文文件正在加载模型,则可能是在 "Data Dictionary/model" 中手动上传了模型。此文件夹可用于在 运行 Alfresco 实例上动态添加新的内容模型。

有没有可能有人想让最终用户可以修改这些约束?

您有部署有效的实例吗?如果是,您能否检查模型是否部署在该文件夹中?