Error "class java.lang.NullPointerException" when editing the email settings on VMware Cloud Director
search cancel

Error "class java.lang.NullPointerException" when editing the email settings on VMware Cloud Director

book

Article ID: 372497

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Cannot add or update Email Settings for newly created Organizations/Tenants
  • When editing the email settings on VMware Cloud Director you have the error below:

<Date Time> | ERROR    | pool-jetty-85291          | DefaultExceptionMapper         | Internal server exception | requestId=<Request ID>,request=PUT https://<VCD_FQDN>/api/admin/org/ORG_ID/settings/email,requestTime=<EPOCH>,remoteAddress=<Client IP>,userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ...,accept=application/*+json;version 39.0.0-alpha
java.lang.NullPointerException
        at com.vmware.ssdc.backendbase.EmailManager.setSmtpFields(EmailManager.java:556)
        at com.vmware.ssdc.backendbase.EmailManager.updateSmtpServer(EmailManager.java:548)
        at com.vmware.ssdc.backendbase.EmailManager.updateEmailSettings(EmailManager.java:520)
        at com.vmware.ssdc.backendbase.CSecurityManager.updateOrgSettings(CSecurityManager.java:2515)

Environment

VMware Cloud Director 10.5.x

Cause

Orgs created using the cloudapi endpoint were not creating entries in the smtp_server and org_email tables.

Resolution

This is a known issue affecting VMware Cloud Director 10.5.x

This issue is resolved in Cloud Director 10.6, available at Broadcom Downloads.

Workaround:

1- Take a DB backup as per documentation at Backup and Restore of VMware Cloud Director Appliance
2- SSH the Cloud Director primary cell
3- Connect to the DB running the command below:

sudo -i -u postgres psql vcloud

4- Run the below queries:

INSERT INTO smtp_server (org_id,server,port,use_authentication,user_name,password,secure_mode,ssl_truststore) 
SELECT organization.org_id,'',0,false,'','','NONE',null FROM organization 
WHERE organization.org_id NOT IN (SELECT org_id FROM smtp_server);

INSERT INTO org_email (org_id,send_email_to_all_admins,alert_email_to,alert_email_from,default_email_prefix) 
SELECT organization.org_id,false,'','','' FROM organization 
WHERE organization.org_id NOT IN (SELECT org_id FROM org_email);

NOTE: This only resolves the issue for Organizations that currently exist, creating a new Organization requires running of the above again or the issue will re-occur.