0
"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."
上面顯示了我的錯誤。 這裏是它試圖在露天創造空間Alfresco java.lang.IllegalStateException在創建空間時出錯
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;
}
請幫我弄清楚這個問題,我的源代碼。 感謝
什麼行是異常觸發? – Gagravarr
您無法使用路徑創建NodeRef aka引用。此行不起作用: space = new引用(STORE,null,parent.getPath()+「/ cm:」+ ISO9075.encode(spacename)); 使用RepositoryService.queryChildren(...)或RepositoryService.query(...)檢查您的空間是否存在(https://wiki.alfresco.com/wiki/Repository_Web_Service) – alfrescian
考慮在可能的情況下使用REST或CMIS - Alfresco CML有些過時 – alfrescian