0

一位操作员删除了数据字典并重新启动了 Alfresco 3.4.12 企业版。上下文 /alfresco 不以以下异常开头:

17:43:11,100 INFO  [STDOUT] 17:43:11,097  ERROR [web.context.ContextLoader] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 08050000 Failed to find 'app:dictionary' node
at org.alfresco.repo.action.scheduled.ScheduledPersistedActionServiceImpl.locatePersistanceFolder(ScheduledPersistedActionServiceImpl.java:132)

查看 org.alfresco.repo.action.scheduled.ScheduledPersistedActionServiceImpl.java 中的源代码,路径是硬连线的。

然后我们按照https://community.alfresco.com/thread/202859-error-failed-to-find-appdictionary-node的提示,编辑 bootstrap-context.xml,注释掉类。

更改后错误消失,现在 RenditionService 无法启动。

我们正在寻找一种方法来恢复已删除的节点,因为我们可以从数据库中获取 nodeid。所以我们创建了一个小类,并通过bootstrap-context.xml中的spring调用它,但是由于权限问题它失败了。您能否看一下代码并告诉我们出了什么问题。代码是:

package com.impulseit.test;

import javax.transaction.UserTransaction;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.node.archive.RestoreNodeReport;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;

public class RestoreNode {
    private NodeArchiveService nodeArchiveService;
    private ServiceRegistry serviceRegistry;
    private String nodeName ="archive://SpacesStore/adfc0cfe-e20b-467f-ad71-253aea8f9ac9";

    public void setNodeArchiveService(NodeArchiveService value)
    {
        this.nodeArchiveService = value;
    }

    public void setServiceRegistry(ServiceRegistry value)
    {
        this.serviceRegistry = value;
    }

    public void doRestore() {
        RunAsWork<Void> runAsWork = new RunAsWork<Void>()
        {
            public Void doWork() throws Exception
            {
                NodeRef nodeRef = new NodeRef(nodeName);
                //RestoreNodeReport restoreNodeReport =
                UserTransaction trx_A = serviceRegistry.getTransactionService().getUserTransaction();
                trx_A.begin();
                AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
                RestoreNodeReport restored = nodeArchiveService.restoreArchivedNode(nodeRef);
                trx_A.commit();
                return null;
            }
        };
        AuthenticationUtil.runAs(runAsWork,AuthenticationUtil.getSystemUserName());
    }

    public RestoreNode() {
    }
}

例外是:

19:31:21,747 User:admin ERROR [node.archive.NodeArchiveServiceImpl] An unhandled exception stopped the restore
java.lang.NullPointerException
    at     org.alfresco.repo.security.permissions.impl.model.PermissionModel.getPermissionReference(PermissionModel.java:1315)
at org.alfresco.repo.security.permissions.impl.PermissionServiceImpl.getPermissionReference(PermissionServiceImpl.java:956)
    at org.alfresco.repo.security.permissions.impl.PermissionServiceImpl.hasPermission(PermissionServiceImpl.java:976)

先感谢您。

路易斯

4

0 回答 0