当前位置: 首页 > 知识库问答 >
问题:

CmisObjectNotFoundException当试图访问我的露天存储库时

勾通
2023-03-14

我是CMIS和AlFresco的新手,当我尝试使用AtomPUB绑定连接到我的AlFresco存储库时遇到了这个错误。我不知道我的问题的来源。除非是功能吗?是我的凭据吗?当我安装它时,我只选择:-AlFresco社区-Solr4

如果我想使用Web服务,我应该怎么做?我应该在我的AlFresco中安装特定的插件吗?

我得到了错误:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/ME%2ME/.m2/repository/org/slf4j/slf4j-simple/1.7.9/slf4j-simple-1.7.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/ME%2ME/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Introuvable
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:499)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:701)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getRepositoriesInternal(AbstractAtomPubService.java:873)
    at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:66)
    at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:92)
    at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:120)
    at org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:107)
    at fr.omb.TestOMB.connect(TestOMB.java:160)
    at fr.omb.TestOMB.main(TestOMB.java:35)

我的代码:

package fr.omb;

import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.apache.chemistry.opencmis.client.api.CmisObject;
import org.apache.chemistry.opencmis.client.api.Document;
import org.apache.chemistry.opencmis.client.api.Folder;
import org.apache.chemistry.opencmis.client.api.Repository;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.client.api.SessionFactory;
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.SessionParameter;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
import org.apache.chemistry.opencmis.commons.enums.BindingType;
import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
import org.apache.chemistry.opencmis.commons.enums.VersioningState;
import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
import org.apache.commons.lang3.StringUtils;

public class TestOMB {

    private static Session session;
    private static final String ALFRSCO_ATOMPUB_URL = "http://localhost:8080/alfresco/service/cmis";
    private static final String TEST_FOLDER_NAME = "chemistryTestFolder";
    private static final String TEST_DOCUMENT_NAME_1 = "chemistryTest1.txt";
    private static final String TEST_DOCUMENT_NAME_2 = "chemistryTest2.txt";

    public static void main(String[] args) {
        Folder root = connect();
        cleanup(root, TEST_FOLDER_NAME);
        Folder newFolder = createFolder(root, TEST_FOLDER_NAME);
        createDocument(newFolder, TEST_DOCUMENT_NAME_1);
        createDocument(newFolder, TEST_DOCUMENT_NAME_2);
        System.out.println("+++ List Folder +++");
        listFolder(0, newFolder);
        DeleteDocument(newFolder, "/" + TEST_DOCUMENT_NAME_2);
        System.out.println("+++ List Folder +++");
        listFolder(0, newFolder);
    }

    /**
     * Clean up test folder before executing test
     * 
     * @param target
     * @param delFolderName
     */
    private static void cleanup(Folder target, String delFolderName) {
        try {
            CmisObject object = session.getObjectByPath(target.getPath() + delFolderName);
            Folder delFolder = (Folder) object;
            delFolder.deleteTree(true, UnfileObject.DELETE, true);
        } catch (CmisObjectNotFoundException e) {
            System.err.println("No need to clean up.");
        }
    }

    /**
     * 
     * @param target
     */
    private static void listFolder(int depth, Folder target) {
        String indent = StringUtils.repeat("\t", depth);
        for (Iterator<CmisObject> it = target.getChildren().iterator(); it.hasNext();) {
            CmisObject o = it.next();
            if (BaseTypeId.CMIS_DOCUMENT.equals(o.getBaseTypeId())) {
                System.out.println(indent + "[Docment] " + o.getName());
            } else if (BaseTypeId.CMIS_FOLDER.equals(o.getBaseTypeId())) {
                System.out.println(indent + "[Folder] " + o.getName());
                listFolder(++depth, (Folder) o);
            }
        }

    }

    /**
     * Delete test document
     * 
     * @param target
     * @param delDocName
     */
    private static void DeleteDocument(Folder target, String delDocName) {
        try {
            CmisObject object = session.getObjectByPath(target.getPath() + delDocName);
            Document delDoc = (Document) object;
            delDoc.delete(true);
        } catch (CmisObjectNotFoundException e) {
            System.err.println("Document is not found: " + delDocName);
        }
    }

    /**
     * Create test document with content
     * 
     * @param target
     * @param newDocName
     */
    private static void createDocument(Folder target, String newDocName) {
        Map<String, String> props = new HashMap<String, String>();
        props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        props.put(PropertyIds.NAME, newDocName);
        System.out.println("This is a test document: " + newDocName);
        String content = "aegif Mind Share Leader Generating New Paradigms by aegif corporation.";
        byte[] buf = null;
        try {
            buf = content.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        ByteArrayInputStream input = new ByteArrayInputStream(buf);
        ContentStream contentStream = session.getObjectFactory().createContentStream(newDocName, buf.length,
                "text/plain; charset=UTF-8", input);
        target.createDocument(props, contentStream, VersioningState.MAJOR);
    }

    /**
     * Create test folder directly under target folder
     * 
     * @param target
     * @param createFolderName
     * @return newly created folder
     */
    private static Folder createFolder(Folder target, String newFolderName) {
        Map<String, String> props = new HashMap<String, String>();
        props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
        props.put(PropertyIds.NAME, newFolderName);
        Folder newFolder = target.createFolder(props);
        return newFolder;
    }

    /**
     * Connect to alfresco repository
     * 
     * @return root folder object
     */
    private static Folder connect() {
        SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
        Map<String, String> parameters = new HashMap<String, String>();

        // User credentials.
        parameters.put(SessionParameter.USER, "myuser");
        parameters.put(SessionParameter.PASSWORD, "mypassword");

        // Connection settings.
        parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
        parameters.put(SessionParameter.ATOMPUB_URL, ALFRSCO_ATOMPUB_URL);
        parameters.put(SessionParameter.AUTH_HTTP_BASIC, "true");
        parameters.put(SessionParameter.COOKIES, "true");

        parameters.put(SessionParameter.OBJECT_FACTORY_CLASS,
                "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

        // Create session.
        // Alfresco only provides one repository.
        Repository repository = sessionFactory.getRepositories(parameters).get(0);
        Session session = repository.createSession();
        return session.getRootFolder();
    }

}

共有1个答案

西门飞翮
2023-03-14

我找到了解决方案,这是因为Alfresco的版本。自V4以来。x AtomPUB的url为http://localhost:8080/alfresco/cmisatom.

https://community.alfresco.com/docs/DOC-5527-cmis

  • 对于AlFresco 3. x:超文本传输协议://[host]:[port]/alFresco/service/cmis
  • 对于AlFresco 4.0. x、AlFresco 4.1. x和AlFresco 4.2. a-c:超文本传输协议://[host]:[port]/alFresco/cmisatom
  • 对于AlFresco 4.2. d-f, AlFresco 5.0和AlFresco 5.1:超文本传输协议://[host]:[port]/alFresco/api/-default-/public/cmis/version/1.0/atom
 类似资料:
  • 我需要从消费者内部访问saga存储库,以读取与正在消费的消息相关的saga的当前状态。 场景:我有一个外部服务,当这个服务使用来自传奇的事件时,我想看看传奇是否仍然处于正确的状态,因为如果同时传奇改变了状态,消费者必须跳过事件。 如何:我当然可以通过使用它的本机框架来查询选择的saga存储库实现,但是我想使用一个抽象,一个接口,从消费者内部加载saga状态,以便将来能够切换到不同的存储库实现。 感

  • 我没有找到任何关于在前端端实现逻辑来管理Azure密钥库的可能性的信息。同时,我创建了一个Node JS服务器项目使用ENV来管理Azure Key Vault,它工作成功,但我想在我的Angular应用程序中得到同样的效果。

  • 问题内容: 我正在尝试在可访问我的私人git存储库的Docker容器中添加一个私钥。testing_git文件位于包含Dockerfile的文件夹中。我正在尝试制作一个可以动态提取git代码的容器。 这是我的Dockerfile: 输出: 因此,当我使用相同的密钥时,可以访问我的存储库。 谁能告诉我我想念的东西吗? 问题答案: 错误消息不是在抱怨您的私钥,而是在抱怨github.com的主机密钥。

  • 同一空间/存储库中机密的逻辑分组 HSM的可能性 日志记录/审核 检索/更改机密的一个位置,许多应用程序可能依赖该位置而不触及应用程序。 我不知道如何在我的Spring Boot应用程序中处理存储库访问。当我使用azure-key-vault spring boot Starter时,我必须设置Applications.Properties中的访问权限,如本教程:如何使用spring boot S

  • 和我的disparcher上下文: 即使我添加了@service和@repositort(“userdao”)

  • 我试图使用Windows Azure开发多层云应用程序。为了存储数据,我选择了Azure存储表和Azure存储Blob。 我的应用程序的不同层使用同一组功能,但方式不同。e、 g.他们都必须能接触斑点。我决定使用单类库来访问Windows Azure Blob存储,但我遇到了一个400错误。 当我直接从工作者角色连接到blob时,它工作正常,但当我从类库调用类时,它失败,状态代码为400(请求错误