Connecting to documentum using java program

knavalg
edited October 25, 2017 in Documentum #1

Hi All,

I am new to documentum & I am looking for the java program to connect to the documentum.

I found the below code:

// This will help you to connect to the repository <br/>  IDfSessionManager createSessionManager(String docbase, String user, String pass)<br/>  throws Exception {<br/>  //create Client objects<br/>  IDfClientX clientx = new DfClientX();<br/>  IDfClient client = clientx.getLocalClient();<br/>   <br/>  //create a Session Manager object<br/>  IDfSessionManager sMgr = client.newSessionManager();<br/>   <br/>  //create an IDfLoginInfo object named loginInfoObj<br/>  IDfLoginInfo loginInfoObj = clientx.getLoginInfo();<br/>  loginInfoObj.setUser(user);<br/>  loginInfoObj.setPassword(pass);<br/>  loginInfoObj.setDomain(null);<br/>   <br/>  //bind the Session Manager to the login info<br/>  sMgr.setIdentity(docbase, loginInfoObj);<br/>  //could also set identity for more than one Docbases:<br/>  // sMgr.setIdentity( strDocbase2, loginInfoObj );<br/>  //use the following to use the same loginInfObj for all Docbases (DFC 5.2 or later)<br/>  // sMgr.setIdentity( * , loginInfoObj );<br/>  return sMgr;<br/>  }

<strong style="font-family: arial,helvetica,sans-serif;">I have included the dfc.jar in the class path.  I run the program using the main()</strong>

public static void main(String[] args) throws Exception {

        // TODO Auto-generated method stub

        IDfSessionManager dfSessionManager = createSessionManager("url","username","password");

        System.out.println(dfSessionManager);

    }

<strong> <span style="font-family: arial,helvetica,sans-serif;">I get the below exception:</span></strong>

Exception in thread "main" java.lang.NoClassDefFoundError: com/rsa/certj/cert/CertificateException

    at com.documentum.fc.client.security.impl.InitializeKeystoreForDfc.execute(InitializeKeystoreForDfc.java:46)

    at com.documentum.fc.client.security.internal.KeystoreMgr.initForDfcWithDefaultPolicy(KeystoreMgr.java:71)

    at com.documentum.fc.client.security.impl.IdentityManager.initFromKeystore(IdentityManager.java:139)

    at com.documentum.fc.client.security.impl.IdentityManager.<init>(IdentityManager.java:41)

    at com.documentum.fc.impl.RuntimeContext.<init>(RuntimeContext.java:52)

    at com.documentum.fc.impl.RuntimeContext.<clinit>(RuntimeContext.java:185)

    at com.documentum.fc.client.DfClient.<clinit>(DfClient.java:772)

    at com.documentum.com.DfClientX.getLocalClient(DfClientX.java:43)

    at Test.createSessionManager(Test.java:46)

    at Test.main(Test.java:36)

Caused by: java.lang.ClassNotFoundException: com.rsa.certj.cert.CertificateException

    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

    ... 10 more

If I put dfc.keystore from another application then the program fails connecting to the url information mentioned in the key store.

I am looking for solution for this program from past couple of days. Please help.

Comments

  • DCTM_Guru
    edited October 16, 2017 #2

    Are you developing in Composer?  If not, I would download it and compile in Composer.  It will generate the appropriate keystore when you try to connect to the repository.

  • knavalg
    edited October 17, 2017 #3

    Hi Johnny,

    I am not using the composer. I am using the java program in eclipse along with the dfc.jar and dfc.properties file. I am not sure whether we need the dfc.keystore file also.

    I also found that we cannot connect to documentum from desktop because of the firewalls. Is it true?

    Thanks

  • DCTM_Guru
    edited October 18, 2017 #4

    I cant speak to your firewall, but if you cant connect from your desktop, then I'm not surprise that you custom java app is not working.

  • Alvaro_de_Andres
    edited October 23, 2017 #5

    knavalg wrote:

    Hi All,

    I am new to documentum & I am looking for the java program to connect to the documentum.

    I found the below code:
    // This will help you to connect to the repository <br/>  IDfSessionManager createSessionManager(String docbase, String user, String pass)<br/>  throws Exception {<br/>  //create Client objects<br/>  IDfClientX clientx = new DfClientX();<br/>  IDfClient client = clientx.getLocalClient();<br/>   <br/>  //create a Session Manager object<br/>  IDfSessionManager sMgr = client.newSessionManager();<br/>   <br/>  //create an IDfLoginInfo object named loginInfoObj<br/>  IDfLoginInfo loginInfoObj = clientx.getLoginInfo();<br/>  loginInfoObj.setUser(user);<br/>  loginInfoObj.setPassword(pass);<br/>  loginInfoObj.setDomain(null);<br/>   <br/>  //bind the Session Manager to the login info<br/>  sMgr.setIdentity(docbase, loginInfoObj);<br/>  //could also set identity for more than one Docbases:<br/>  // sMgr.setIdentity( strDocbase2, loginInfoObj );<br/>  //use the following to use the same loginInfObj for all Docbases (DFC 5.2 or later)<br/>  // sMgr.setIdentity( * , loginInfoObj );<br/>  return sMgr;<br/>  }

    <strong style="font-family: arial,helvetica,sans-serif;">I have included the dfc.jar in the class path.  I run the program using the main()</strong>
    public static void main(String[] args) throws Exception {
            // TODO Auto-generated method stub
            IDfSessionManager dfSessionManager = createSessionManager("url","username","password");
            System.out.println(dfSessionManager);
        }

    <strong> <span style="font-family: arial,helvetica,sans-serif;">I get the below exception:</span></strong>
    Exception in thread "main" java.lang.NoClassDefFoundError: com/rsa/certj/cert/CertificateException
        at com.documentum.fc.client.security.impl.InitializeKeystoreForDfc.execute(InitializeKeystoreForDfc.java:46)
        at com.documentum.fc.client.security.internal.KeystoreMgr.initForDfcWithDefaultPolicy(KeystoreMgr.java:71)
        at com.documentum.fc.client.security.impl.IdentityManager.initFromKeystore(IdentityManager.java:139)
        at com.documentum.fc.client.security.impl.IdentityManager.<init>(IdentityManager.java:41)
        at com.documentum.fc.impl.RuntimeContext.<init>(RuntimeContext.java:52)
        at com.documentum.fc.impl.RuntimeContext.<clinit>(RuntimeContext.java:185)
        at com.documentum.fc.client.DfClient.<clinit>(DfClient.java:772)
        at com.documentum.com.DfClientX.getLocalClient(DfClientX.java:43)
        at Test.createSessionManager(Test.java:46)
        at Test.main(Test.java:36)
    Caused by: java.lang.ClassNotFoundException: com.rsa.certj.cert.CertificateException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 10 more

    If I put dfc.keystore from another application then the program fails connecting to the url information mentioned in the key store.

    I am looking for solution for this program from past couple of days. Please help.

    You need additional jar files, not just dfc.jar. Try adding certj.jar from DFC to the classpath, the error should change.

  • lastnitescurry
    edited October 25, 2017 #6

    Bare bones dfc program needs at least 5 or 6 jars. Sorry can not remember which one's. Trial and error, keeping adding until no more problems

    dfc.keystore should not be copied from another location. Delete it. It will be regenerated with details of current DFC client location.

  • knavalg
    edited October 25, 2017 #7

    Thank you very much.