我编写了两个模型文件。对于某些关联,两个模型都引用了另一个文件中的类型。我还更新了上下文文件中bean的依赖标记(一个模型依赖于另一个模型)(我知道依赖标记指的是已经创建的bean)。我在tomcat中运行时抛出错误。
(1)有没有办法实现上述目的而没有错误?
(2)如果没有,将所有类型放在一个模型文件中,这是我需要做的吗?
这是abc-model-context.xml中的bean声明
<bean id="exampleOne.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/model/defModel.xml</value>
<value>alfresco/extension/model/abcModel.xml</value>
<value>alfresco/extension/model/ghiModel.xml</value>
</list>
</property>
</bean>
这是错误的堆栈跟踪。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exampleOne.dictionaryBootstrap' defined in file [C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\abc-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 00150001 Could not import bootstrap model alfresco/extension/model/defModel.xml
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
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.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
引起:org.alfresco.service.cmr.dictionary.DictionaryException:00150001无法导入bootstrap模型alfresco / extension / model / defModel.xml at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:158) at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:105) 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) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ......还有27个 引起:org.alfresco.service.cmr.dictionary.DictionaryException:00150000无法编译模型def:defModel 在org.alfresco.repo.dictionary.CompiledModel。(CompiledModel.java:108) at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:163) at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModelImpl(DictionaryDAOImpl.java:311) at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:294) at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:154) ......还有35个 引起:org.alfresco.service.namespace.NamespaceException:无法导入URI http://www.exampleOne.org/model/abc/1.0,因为它未定义(带有前缀abc) at org.alfresco.repo.dictionary.CompiledModel.createLocalPrefixResolver(CompiledModel.java:206) at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:130) 在org.alfresco.repo.dictionary.CompiledModel。(CompiledModel.java:88) ... 39更多
答案 0 :(得分:2)
我怀疑你的defModel.xml文件格式错误或无效。确保在XML-aware编辑器中打开它时不会抱怨。您可能还想根据位于$ TOMCAT_HOME / webapps / alfresco / WEB-INF / classes / alfresco / model中的modelSchema.xsd进行检查。
答案 1 :(得分:1)
查看http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Model_Bootstrapping
字典引导程序bean支持模型的列表属性:
<property name="models">
<list>
<value>my/customModel1.xml</value>
<value>my/customModel2.xml</value>
</list>
</property>
因此,最简单的解决方法是在两个模型中只使用一个bean。