Home Documentum

Connecting to documentum using java program

edited October 25, 2017 in Documentum

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

I have included the dfc.jar in the class path.  I run the program using the main()

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

        // TODO Auto-generated method stub

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

        System.out.println(dfSessionManager);

    }

I get the below exception:

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.

Tagged:

Comments

  • edited October 16, 2017

    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.

  • edited October 17, 2017

    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

  • edited October 18, 2017

    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.

  • edited October 23, 2017

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


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

    I get the below exception:
    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.

  • edited October 25, 2017

    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.

  • edited October 25, 2017

    Thank you very much.

Sign In or Register to comment.