有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

露天爪哇岛。lang.IllegalStateException创建空间时出错

"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;
}

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


共 (1) 个答案

  1. # 1 楼答案

    用这个代替:

    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

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