2

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.

Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190
Akhil
  • 391
  • 3
  • 20

1 Answers1

0

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);
    }
}
  • thanks @miguel lopes martins for your help,what I am actually doing is getting many sessions by using threads,So I got the error of reference count is already zero,I tried your code but its not working,please suggest me what to do,Is it mandatory to set the primary host and primary port?? – Akhil Apr 25 '18 at 10:23
  • If I recall correctly, it is not mandatory to set the primary host and primary port, though if you do not set them, it will fetch them from the C:\Windows\dmcl.ini file, under the DOCBROKER_PRIMARY section. – Miguel Lopes Martins Apr 26 '18 at 08:28
  • I removed the lines of setting the host and the port from the code ,It worked fine,But i am not using the dmcl.ini file,I am using the dfc.properties file ,Is it the correct way to do it??,Is it mandatory to use the dmcl.ini file ??or can I manage with dfc.properties?? – Akhil Apr 26 '18 at 09:34
  • I can't say for sure. In my case, if I don't have the dmcl.ini file and don't set the primary host and primary port, it gives me the following exception: [DM_DOCBROKER_E_DMCL_INI_WIN32_MISSING]error: "DocBroker connection failed (no dmcl.ini). Search rules: 1) %%DMCL_CONFIG%% specifies a file 2) current directory 3) %%DOCUMENTUM%% specifies a directory with dmcl.ini 4) Windows dir." Maybe they changed the behavior in more recent versions of Documentum DFCs? I don't know for sure. – Miguel Lopes Martins Apr 26 '18 at 10:42
  • does your code works by removing the dmcl.ini file and by adding dfc.properties?? – Akhil Apr 27 '18 at 12:54
  • It doesn't seem to work, no. But I am using Documentum 5.3. Apparently there's two properties you can set: dfc.docbroker.host and dfc.docbroker.port, but neither of those work for me. Again, maybe it's because I'm using an older version of Documentum. – Miguel Lopes Martins Apr 27 '18 at 14:28