Integration Agent will not start due to "Base64" exception

A client recently encountered a problem when attempting to start a newly-installed Integration Agent. When the Integration Agent failed to start, the client checked the log files and found the following error message:

ERROR - The script for Integration Service (applications,bmcbppm30) could not be created due to an exception.
com.alarmpoint.integrationagent.exceptions.ScriptCreationException: The script for Integration Service
(applications,bmcbppm30) could not be created due to an exception.
...
Caused by: org.mozilla.javascript.EvaluatorException: Cannot import "Base64" since a property by that name
is already defined. (integrationservices/bmcbppm30/lib/javascript/webservices/wsutil.js#10)

Cause

This issue occurred because the Integration Agent version 5.1.8 uses Java 1.8, which offers new functionality, and includes a class called Base64. Previous Integration Agents used earlier versions of Java which did not include this class, and therefore had to explicitly import Base64 from another source.

In Integration Agent 5.1.8, the explicit "import" instruction fails because the class already exists, and this prevents the Integration Agent from starting up.

This problem is most likely to occur after upgrading an existing Integration Agent to version 5.1.8, or when installing a new integration using Integration Agent 5.1.8.

Resolution

If you encounter this issue, use the following steps to resolve it and start your Integration Agent:

  1. Locate the Base64 error message in your Integration Agent log and note the name of the file that is causing the exception. 
    • In the above error message, the problem file is integrationservices/bmcbppm30/lib/javascript/webservices/wsutil.js
  2. Open the file in a text editor and find the instruction or import command causing the BASE64 class to be loaded.
    • In the error message above, the line number is appended to the file name: wsutil.js#10
  3. Insert "// " at the beginning of the line to comment out the instruction.
    • For example, replace:
      importClass(Packages.org.apache.commons.codec.binary.Base64);
      with:
      // importClass(Packages.org.apache.commons.codec.binary.Base64);
  4. Save the file, and then restart the Integration Agent.

 

If Your Integration Script Requires Base64Encode

If your find that your integration script requires the Base64Encode function, you can use JRE 8's built-in Base64 functionality instead of the version imported from Apache.  Recall that JRE 8 is included with IA 5.1.8 and later only.

Using the HP NNMi integration as an example, you can replace

this.authorization = this.base64Encode(NNMI_USER+":"+NNMI_PASSWORD);

with

var nnmiCred = NNMI_USER + ":" + NNMI_PASSWORD;
this.authorization = "" + java.util.Base64.getEncoder().encodeToString( new java.lang.String(nnmiCred).getBytes() );

 

xMatters internal reference: DOC-5878, SUP-14304

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk