gpt4 book ai didi

java - Alfresco 创建空间时出现 java.lang.IllegalStateException 错误

转载 作者:行者123 更新时间:2023-12-02 06:39:47 25 4
gpt4 key购买 nike

"java.lang.IllegalStateException: Failed to resolve to a single NodeRef with parameters (store=workspace:SpacesStore uuid=null path=/app:company_home/cm:DCSL_DOCS/cm:Scanned_Docs), found 0 nodes."

上面显示了我的错误。这是我的源代码,它试图在露天创建空间

protected Reference createSpace(Reference parentref, String spacename) throws Exception {
Reference space = null;
ParentReference parent = ReferenceToParent(parentref);
try {
System.out.println("Entering space:" + spacename+":");
space = new Reference(STORE, null, parent.getPath() + "/cm:" + ISO9075.encode(spacename));
WebServiceFactory.getRepositoryService().get(new Predicate(new Reference[]{space}, STORE, null));
} catch (Exception e1) {
System.out.println("The space named " + spacename + " does not exist. Creating it.");
parent.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, normilizeNodeName(spacename)));
//Set the space's property name
NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, spacename)};
// Create the space using CML (Content Manipulation Language)
CMLCreate create = new CMLCreate("1", parent, null, null, null, Constants.TYPE_FOLDER, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});

//Execute the CML create statement
try {
getRepositoryService().update(cml);
} catch (Exception e2) {
e2.printStackTrace();
System.err.println("Can not create the space.");
throw e2;
}
}
return space;
}

请帮我解决这个问题。谢谢

最佳答案

改用这个:

ParentReference parentReference = new ParentReference(STORE, null, parent.getPath() + "/cm:" + ISO9075.encode(spacename), Constants.ASSOC_CONTAINS, Constants.ASSOC_CONTAINS);

检查 Alfresco SDK 中的示例:samples\WebServiceSamples\source\org\alfresco\sample\webservice\CMLUpdates.java

在此示例中,它获取带有路径的父引用,并在文件夹中创建一个额外的文件。

关于java - Alfresco 创建空间时出现 java.lang.IllegalStateException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19266871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com