Domanda

I have used EMC Documentum Foundation Classes to perform some actions in documentum repository. The code was working fine. I exported the project as a runnable JAR and then tried to run it. However I got following error and I am not able to understand it.

enter image description here

And here is the code for DocMovementHandler.getSession() Actually this is no new code but regular code for obtaining documentum session

public IDfSession getSession(String userName, String password)
{
    DfClientX clientx = null;
    IDfClient client = null;
    IDfSession session = null;
    try {
        // create a client object using a factory method in DfClientX
        clientx = new DfClientX();
        client = clientx.getLocalClient();   //takes time

        // call a factory method to create the session manager
        IDfSessionManager sessionMgr = client.newSessionManager();

        // create an IDfLoginInfo object and set its fields
        IDfLoginInfo loginInfo = clientx.getLoginInfo();
        loginInfo.setUser(userName);
        loginInfo.setPassword(password);

        // set single identity for all docbases
        sessionMgr.setIdentity("xyz_repo", loginInfo);
        session = sessionMgr.getSession("xyz_repo");   //takes time 
        //sessionMgr.beginTransaction();
        System.out.println("Session obtaied.");         
    }
    catch (DfServiceException dse)
    {
        DfLogger.debug(this, "Error while beginning transaction. ", null, dse);
        dse.printStackTrace();
    }

    catch (Exception e) 
    {
        DfLogger.debug(this, "Error while creating a new session. ", null, e);
        e.printStackTrace();
    } 
    return session;
}

And that line 38 is client = clientx.getLocalClient();

È stato utile?

Soluzione 5

Ohkay I did not pin pointed the root cause, but found the solution that will definitely work everytime. EMC provides a flavor of Eclipse called Documentum Composer to work with Documentum Projects. Since Eclipse variation we can create other types of projects like normal Java project, dynamic web project, web services in this. So I recreated my project in Documetnum Composer and exported it as JAR and whoaaaa it worked.

I tried this many times and this worked all time.

Some points to note:

  • You have to replace dfc.properties file in Composer installation folder with one in Content Server
  • The Export to JAR wizard in Composer is a bit different than one in Eclipse

Altri suggerimenti

InvocationTargetException is a wrapper. It says, "an exception occurred behind this reflection call", and you use getCause() to get at the inner exception.

The stack trace contains the inner exception. It's an ExceptionInInitializerError. That's another wrapper. It says, "whatever you did caused a new class to be loaded, and that class's static initializer threw an exception".

The final exception in this chain is the NullPointerException. That's the one you need to solve. Which means you need to debug this com.documentum thing. As the comments pointed out, that's not going to be easy.

Here is the most likely problem:

The static initializer in one of the classes whose names you have struck is adding an entry with either a null key or a null value to a Hashtable, which does not allow null keys or values.

It is using the Hashtable as a place to store a bunch of persistent properties and all that, and my guess is that the value for one of the entries was the null (which is a perfectly reasonable way to indicate that some feature is unavailable or something like that).

The now deprecated Hashtable needs to be replaced with the more modern HashMap.

If it is a library, that you can't just modify, you should replace the whole library with an updated version.

Here are some clues may be helpful. The NullPointerException is thrown by Hashtable#put, and this is normally because either the key or the value is null.

Hashtable#put is called by PreferenceManager.readPersistenceProperties, so most likely it's because something is missing in a properties file so the value is null.

This NPE caused the DfClient class could not be loaded.

DfPreferences is the class loading the DFC configuration file dfc.properties. There must be something wrong with it.

This is usually caused by dfc.properties being incorrect.

Preferences are stored on the global registry repository and the connection details should be specified in dfc.properties. If not, this (or a similar error can occur).

Also, always try to clear cache and use the correct version of the dfc jar's (v6.7 content server requires 6.7 jars, etc...).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top