Error while running documentum code

1.8k views Asked by At

I am getting an error while running the documentum code at:

config.setString("primary_host", docbroker); 

in the below code:

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

and the error I was getting is below:

Error:

        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)

Please can anyone help me. I am new to documentum.

1

There are 1 answers

6
Miguel Lopes Martins On

From my experience, it is best to use the IDfClientX interface and work your way from there. Perhaps this example will help you:

// 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);
    }
}