Alfresco:无法创建目录

时间:2016-07-22 12:50:28

标签: alfresco alfresco-share opencmis apache-chemistry

我创建了一个使用apache化学在alfresco中创建文档的简单示例。我工作得很好,能够创建文档。但是,当我重新启动我的机器和露天服务器时,现在同一个程序给我错误 -

  

org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException:06220002无法为文件存储创建目录:/ home / alfresco / alfresco-community / alf_data / contentstore / 2016/7/22/16/57       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:523)       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:717)       at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:122)       在org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1165)       在org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77)       在org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:460)       在com.bizruntime.alfresco.cmis.upload.C​​reateDocument.createDocumentInAlfrescoRepository(CreateDocument.java:81)       在com.bizruntime.alfresco.cmis.upload.C​​reateDocumentTest.testCreateDocInAlfrescoRepository(CreateDocumentTest.java:16)       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.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:50)       在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)       在org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)       在org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)       在org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)       在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)       在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)       在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290)       在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:71)       在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)       在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:58)       在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268)       在org.junit.runners.ParentRunner.run(ParentRunner.java:363)       在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)       在org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)       在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)       在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)       在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)       在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

请有人帮忙。

2 个答案:

答案 0 :(得分:1)

我猜您的主机上存在文件权限问题!要验证问题,您需要使用共享界面在alfresco上传/创建文档,如果您没有成功,这意味着我的疑虑是正确的:运行tomcat实例的系统用户无权写入alf_data目录

可能的原因:系统配置错误,您正在与其他用户一起运行alfresco服务....

候选解决方案:

  1. 检测哪些用户应该在露天运行(可能是/home/alfresco的所有者)你可以通过运行它找到它:

    root@alfhost$>ls -la /home/alfresco
    
  2. 假设用户名为alfresco,请在您的主机上使用root帐户运行此脚本:

    root@alfhost$>chown alfresco /home/alfresco -R
    
  3. 使用同一帐户重新启动您的服务

答案 1 :(得分:0)

试试这个对我来说很好

public static void createNewFolderIn(String serverUrl, String username, String password, String path, String folderName) {
    Folder root = getFolderByPath(serverUrl, username, password, path);
    Map<String, Object> properties = new HashMap<>();
    properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());

    properties.put(PropertyIds.NAME, folderName);
    List<Ace> addAces = new LinkedList<>();
    List<Ace> removeAces = new LinkedList<>();
    List<Policy> policies = new LinkedList<>();
    Folder newFolder = root.createFolder(properties, policies, addAces, removeAces, getSession(serverUrl, username, password).getDefaultContext());

}