Solution

Make the following changes in your sudoer's file:

  1. Remove entry Default requiretty, if it exists in your sudoer's file.
  2. If sudoers file contains entry Default env_reset, add the following entries after this parameter:
    Defaults env_keep="JRE_HOME PERL5LIB EMDROOT"