java.lang.NullPointerException - While using SecureCredentialsStore or ContentService or SmartServiceContext

I am trying to write a custom plugin for reading emails from POP3 servers. Below is the snippet that gives "java.lang.NullPointerException". Any help is appreciated. 

public static Long createFolder(ContentService contentSvc, Long folderId, String folderName, boolean unique) throws Exception {

    Integer uniqueness = unique ? ContentConstants.UNIQUE_FOR_PARENT : ContentConstants.UNIQUE_NONE;

    KnowledgeFolder newFolder = new KnowledgeFolder();

    newFolder.setParent(folderId);

    newFolder.setName(folderName);

    newFolder.setDescription(folderName);

    newFolder.setSecurity(14);

    Long newFolderId = contentSvc.create((Content)newFolder, uniqueness);

    return newFolderId;

}

variables in SmartService class defined as below

public class ReadPOP3EmailsWithAttachments extends AppianSmartService {

private static final Logger LOG = Logger.getLogger("ReadEmailsToCDT");

private SmartServiceContext smartServiceCtx;

private SecureCredentialsStore scs;

private ContentService cs;

private String userName;

private String password;

private String host;

private Long documentFolderId;

private WMGEmail[] wmgEmails = null;

@Override

public void run() throws SmartServiceException {

try {

Long folderId = DocumentServices.createFolder(cs, documentFolderId, new Date().toGMTString(), true);

Parents Reply Children
No Data

 Discussion posts and replies are publicly visible