Error while running Job

Hi All,

I have created a job for my custom method. When I run the job, I get below error message. (The Job report is also Blank)

Last Status : FAILED: Method myMethod return value was 127

Any suggestions?

Comments

  • Did you validate that your method works correctly? You can run method independent of job.

  • Hi,

    I am getting below error when I run run my method

    The server encountered an internal error () that prevented it from fulfilling this request
    javax.servlet.ServletException: java.lang.ClassNotFoundException: mymodule
    com.documentum.mthdservlet.DoMethod.invokeMethod(Unknown Source)
    com.documentum.mthdservlet.DoMethod.doPost(Unknown Source)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

    I have installed this project from Documentum composer. Artifacts I have createdr:

    myjardef which has my project.jar file

    mymodule module which has this jardef (in implementation jars) and class (public class ldapSession extends DfSingleDocbaseModule implements IDfMethod, IDfModule)

    and mymethod which has verb: mymodule

    Please suggest

    Thanks.

  • I tried running the method again and got new error

    [DM_METHOD_E_HTTP_COMMUNICATION]error: "Failed to obtain socket for host

  • Hard to tell what your problem is without seeing your code

  • Hi, I am getting below error message:

    07:19:11,164 INFO [stdout] (http--0.0.0.0-9080-4) 07:19:11,163 ERROR [http--0.0.0.0-9080-4] com.documentum.mthdservlet.DoMethod - Exception invoking com.documentum.session.ldapSession.
    07:19:11,190 INFO [stdout] (http--0.0.0.0-9080-4) at com.documentum.session.ldapSession.newSession(ldapSession.java:53)
    07:19:11,195 INFO [stdout] (http--0.0.0.0-9080-4) at com.documentum.session.ldapSession.execute(ldapSession.java:226)

    My code for new session
    package com.documentum.session;

    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.Map;
    import java.util.Properties;

    import org.apache.log4j.Logger;

    import com.documentum.com.DfClientX;
    import com.documentum.com.IDfClientX;
    import com.documentum.fc.client.DfClient;
    import com.documentum.fc.client.DfQuery;
    import com.documentum.fc.client.DfSingleDocbaseModule;
    import com.documentum.fc.client.IDfClient;
    import com.documentum.fc.client.IDfCollection;
    import com.documentum.fc.client.IDfQuery;
    import com.documentum.fc.client.IDfSession;
    import com.documentum.fc.client.IDfSessionManager;
    import com.documentum.fc.common.DfException;
    import com.documentum.fc.common.IDfLoginInfo;
    import com.documentum.fc.methodserver.IDfMethod;
    import com.documentum.fc.tools.RegistryPasswordUtils;
    import com.documentum.mail.mailer;

    public class ldapSession extends DfSingleDocbaseModule implements IDfMethod {

    public static Logger logger = Logger.getLogger(ldapSession.class);
    private PrintWriter pw;
    
    
    public static IDfSession newSession(String documentumUsername, String documentumPassword, String repositoryName) throws DfException, IOException{
        IDfSession session = null;
        logger.info("Creating session...");
    
        IDfClientX clientx = new DfClientX();
        IDfClient client = clientx.getLocalClient();
        IDfLoginInfo loginInfoObj = clientx.getLoginInfo();
        Properties properties = new Properties();
        InputStream input = null;
        logger.info("Locating dctm.properties in CLASSPATH...");
    
        input = ldapSession.class.getClassLoader().getResourceAsStream("dctm.properties");
        properties.load(input);
        if (input != null) {
                input.close();
            }
        logger.info("dctm.properties file found");
    
        documentumUsername=properties.getProperty("DCTM_USERNAME");
    
        documentumPassword=properties.getProperty("DCTM_ENCRYPT_PASSWORD");
    
        repositoryName=properties.getProperty("DCTM_DOCBASE");
    
    
        loginInfoObj.setUser(documentumUsername);
        logger.info("Decrypting documentum password...");
        try{
    
        loginInfoObj.setPassword(RegistryPasswordUtils.decrypt(documentumPassword));
        logger.info("Documentum password decrypted");
    
        }catch(Exception e)
        {
            logger.error(e);
    
        }
    
        IDfSessionManager sessionMgr = DfClient.getLocalClient().newSessionManager();
    
        logger.info("Trying to get a new session");
    
        // login
       if (sessionMgr != null) {
          sessionMgr.setIdentity(repositoryName, loginInfoObj);
          session = sessionMgr.getSession(repositoryName);
       } else {
        throw new DfException("Could not create Session Manager.");
       }
         logger.info("Session created with docbase" +repositoryName);
          return session;
    }
    

    EXCUTE CODE::

    public int execute(Map agruments, PrintWriter writer) throws Exception {

     {
        this.pw=writer;
        IDfSession session = null;
        String documentumUsername=null;
        String documentumPassword=null;
        String respositoryName=null;
        try {
    
            logger.info("Trying to Login");
            session=newSession(documentumUsername,documentumPassword,respositoryName);
            if (session != null) {
    
            logger.info("Session was created successfully with session ID: " +session.getSessionId());
            logger.info("logged off");
            }else {
              logger.error("Login failed");
            }
        } catch (DfException dfe) {
            logger.error("Exception occured" +dfe);
            dfe.printStackTrace();
        logger.info("logged off");
    
        }else {
              logger.error("Login failed");
            }
        } catch (DfException dfe) {
            logger.error("Exception occured" +dfe);
            dfe.printStackTrace();
            try {
                mailer.sendMail("mail id to send to", "from mail id", "SMTP host name");
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("Exception occured while sending email:" +e);
            }
        } catch (IOException e) {
            logger.error("Exception occured" +e);
            e.printStackTrace();
            try {
                mailer.sendMail("mail id to send to", "from mail id", "SMTP host name");
            } catch (Exception ex) {
                ex.printStackTrace();
                logger.error("Exception occured while sending email:" +e);
            }
        }
        return 0;
    }
    }
    

    }

  • So what does line 53 point to? You are making it very hard for us to help you if you make us try to decrypt simple debugging techniques :)

  • My apologies. This has been resolved now. I was trying to use .properties file for password, but I have used trusted login to solve this.

  • Although I have encountered another issue.
    1. When using BOF modules (from composer) and installing it in a repository, where does it create log4j.properties file that I have in my documentum.config folder?
    2. I am unable to find my log file on Content Server (UNIX). I have a functionality that triggers mail (with log file attachment) ; but I am getting
    - MessageException occured in Mail.sendMailtoDistributionList() javax.mail.MessagingException: IOException while sending message;

    So If i want my method to create a log file when invoked where should I place the log4j file on Unix server?

  • Don't recall off the top of my head - try looking in the JMS log/logs dir.

  • Regarding

    1. When using BOF modules (from composer) and installing it in a repository, where does it create log4j.properties file that I have in my documentum.config folder?

    DO NOT packages your log4j.properties with your Module. Logging configuration is environment specific and should not be hard coded by you.

    For server methods, you want to review and update if required the log4j.properties under ServerApps.ear

    Regarding

    1. I am unable to find my log file on Content Server (UNIX). I have a functionality that triggers mail (with log file attachment) ; but I am getting
      • MessageException occured in Mail.sendMailtoDistributionList() javax.mail.MessagingException: IOException while sending message;

    So If i want my method to create a log file when invoked where should I place the log4j file on Unix server?

    If you are creating a custom log, then I suggest you read some of the environment variables which denote environment specific and valid folder locations. For example jboss.server.log.dir points to the log directory of the JBoss instance hosting ServerApps.ear

    See JBoss boot.log file for a dump of environment specific variables. This is where I can see jboss.server.log.dir setting

    Brian Dinneen
    ECD Documentum Designated Support Engineer

    image