Alfresco:无法创建目录

Alfresco: Failed to create directory

我已经创建了一个简单的示例来使用 apache chemistry 在露天创建文档。我工作正常并且能够创建文档。但是当我重新启动我的机器和露天服务器时,现在相同的程序给我错误 -

org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 06220002 Failed to create directory for file storage: /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) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1165) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:77) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:460) at com.bizruntime.alfresco.cmis.upload.CreateDocument.createDocumentInAlfrescoRepository(CreateDocument.java:81) at com.bizruntime.alfresco.cmis.upload.CreateDocumentTest.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) at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner.run(ParentRunner.java:290) at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access[=10=]0(ParentRunner.java:58) at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

请有人帮忙。

我猜你的主机文件权限有问题!要验证该问题,您需要使用共享界面 upload/create 露天文档,如果您没有成功,这意味着我的怀疑是正确的:系统用户 运行 宁您的 tomcat实例无权写入 alf_data 目录。

可能的原因:系统配置错误,您正在运行使用不同的用户进行露天服务....

候选解:

  1. Detect which user should be 运行ning alfresco (probably the owner of /home/alfresco) 你可以通过 运行ning 找到它:

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

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

试试这个对我来说效果很好

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());

}