API Portal Connection to external SMTP server could not be established , http error 500
search cancel

API Portal Connection to external SMTP server could not be established , http error 500

book

Article ID: 270033

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

When navigating to 'Email/SMTP Settings' in API portal UI, there is a HTTP 500 Server error and nothing is showed.

Unable to setup or change the Email/SMTP Settings from the UI.

The portal data log shows a error for the SMTP settings in the database.

[ERROR] [c.l.p.e.e.NotificationExceptionHandler] [http-nio-8080-exec-4] [ff46425b465fd40d89927b8a1f00ff5d|5c2ac525aca41cc4] [apiportal|admin|Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36|cb8024e45b17$200]nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'SSL_AUTH_TYPE' from result set.  Cause: java.lang.IllegalArgumentException: No enum constant com.ca.apim.notify.server.domain.ServerProperties.SslAuthType. portal_portal-data.   | org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column SSL_'AUTH_TYPE' from result set.  Cause: java.lang.IllegalArgumentException: No enum constant com.ca.apim.notify.server.domain.ServerProperties.SslAuthType.
portal_portal-data  |     at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)

Environment

API Portal 5.2.x

Resolution

The log shows there is a problem with the SSL_AUTH_TYPE field in the NOTIFICATION_CONFIG table.

portal_portal-data.0 | org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'SSL_AUTH_TYPE' from result set.  Cause: java.lang.IllegalArgumentException: No enum constant com.ca.apim.notify.auth.domain.ServerCredentials.ServerAuthType.SERVER

Connect to the MySQL portal database .

Run the following query to verify the table  NOTIFICATION_CONFIG:  select * from  NOTIFICATION_CONFIG \G;

example output 

mysql> select * from  NOTIFICATION_CONFIG \G;
*************************** 1. row ***************************
                  UUID: tenantname
     NOTIFICATION_TYPE: EMAIL
           SERVER_TYPE: SMTP
             AUTH_TYPE: BASICAUTH
             TENANT_ID: tenantid
                  HOST: snmtp host name 
                  PORT: 25
      CERTIFICATE_NAME: NULL
   CERTIFICATE_CONTENT: NULL
   DEFAULT_SENDER_NAME: NULL
DEFAULT_SENDER_ADDRESS: [email protected]
        BOUNCE_ADDRESS: [email protected]
               ENABLED: 0x01
             CREATE_TS: 1678718929001
             MODIFY_TS: 1690899150671
            CREATED_BY: NOTIFICATION-SERVER
           MODIFIED_BY: admin
              PROTOCOL: PLAIN
         SSL_AUTH_TYPE: NULL
    VERIFICATION_EMAIL: [email protected]
                STATUS: ACTIVE
      CLIENT_CERT_UUID: NULL

The SSL_AUTH_TYPE should not be NULL for AUTH_TYPE other than BASICAUTH.

1. Make sure you have a valid backup for the portal databases before making the following change in MySQL 

2. Set the AUTH_TYPE back to BACISAUTH using MySQL:

update NOTIFICATION_CONFIG SET AUTH_TYPE = 'BASICAUTH' where UUID ='tenantname';

update NOTIFICATION_CONFIG SET SSL_AUTH_TYPE = NULL  where UUID ='tenantname';

3. Open the SMTP config in the portal UI and verify you can set the SMTP config again.