运行documentum代码时出错

时间:2018-03-23 08:47:59

标签: documentum documentum6.5 documentum-dfs documentum-dfc documentum7.3

我在运行文档代码时遇到错误:

config.setString("primary_host", docbroker); 

在下面的代码中:

IDfClient client = DfClient.getLocalClient();
// getting the config object of local client
IDfTypedObject config = client.getClientConfig();
config.setString("primary_host", docbroker);
IDfLoginInfo li = new DfLoginInfo();

我得到的错误如下:

  

错误:

        java.lang.IllegalStateException: Reference count is already zero
    at com.documentum.fc.impl.util.ReferenceCountManager.decrement(ReferenceCountManager.java:47)
    at com.documentum.fc.client.impl.docbroker.DocbrokerMapUnion.decrementReferenceCount(DocbrokerMapUnion.java:43)
    at com.documentum.fc.client.impl.docbroker.DocbrokerMapUnion.removeEntry(DocbrokerMapUnion.java:37)
    at com.documentum.fc.client.impl.docbroker.DocbrokerMap.removeEntries(DocbrokerMap.java:176)
    at com.documentum.fc.client.impl.docbroker.DocbrokerClient$PreferencesObserver.update(DocbrokerClient.java:251)
    at com.documentum.fc.common.impl.preferences.TypedPreferences.notifyObservers(TypedPreferences.java:559)
    at com.documentum.fc.common.impl.preferences.TypedPreferences.setString(TypedPreferences.java:168)
    at com.gsk.rd.datacoe.dataspider.FetchDocumentumStats.connectToDocumentum(FetchDocumentumStats.java:357)
    at com.gsk.rd.datacoe.dataspider.FetchDocumentumStats.run(FetchDocumentumStats.java:92)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

任何人都可以帮助我。我是documentum的新手。

1 个答案:

答案 0 :(得分:0)

根据我的经验,最好使用IDfClientX界面并从那里开始工作。也许这个例子可以帮助你:

// This is just an example. You might want to encapsulate this functionality in a class of your own 

import com.documentum.com.DfClientX;
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.IDfClient;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.client.IDfTypedObject;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.IDfLoginInfo;

public class Main {

    public static void main(String[] args) throws DfException {
        IDfClientX clientX = new DfClientX();
        IDfClient client = clientX.getLocalClient();
        IDfTypedObject clientConfig = client.getClientConfig();
        IDfLoginInfo loginInfo = clientX.getLoginInfo();
        IDfSessionManager sessionManager = client.newSessionManager();
        IDfSession session = connect(clientConfig, loginInfo, sessionManager, "<your host here>", 1489, "<your docbase here>", "<your username here>", "<your password here>");
        // Do something with session
    }

    public static IDfSession connect(IDfTypedObject clientConfig, IDfLoginInfo loginInfo, IDfSessionManager sessionManager, String host, int port, String docbase, String user, String password) throws DfException {
        clientConfig.setString("primary_host", host);
        clientConfig.setInt("primary_port", port);
        loginInfo.setUser(user);
        loginInfo.setPassword(password);
        sessionManager.clearIdentities();
        sessionManager.setIdentity(docbase, loginInfo);
        return sessionManager.getSession(docbase);
    }
}