Solution
Background
The Layer 7 Gateway stores audit records in the local MySQL database by default. Several audit records are generated when the Gateway initializes. If the Gateway is unable to generate these audit records and store them in the Gateway database then the Gateway will fail to start. This behavior typically occurs because the Gateway was terminated abruptly and it is trying to reinsert an audit record using an ordinal value that already exists in the Gateway database.
Presentation
The following log entry would appear in the Gateway's primary log file should this issue occur:
**** Unable to start the server: Lifecycle error: Hibernate operation: Could not execute JDBC batch update; SQL [insert into audit_detail (time, component_id, ordinal, message_id, exception, audit_oid, objectid) values (?, ?, ?, ?, ?, ?, ?)]; Duplicate entry '[integer]' for key 1;
Resolution
This can be resolved by removing the audit record causing the duplicate entry error.This audit record is indicated by the integer value specified in the error message above. This record can be removed via a MySQL query against the Gateway database. To resolve this issue, execute the following procedure:
- Log into the Layer 7 Gateway appliance as the?ssgconfig?user.
- Select Option #3: Use a privileged shell (root).
- Take a Gateway backup: ssgbackup.sh -image [image name] -maindb
- Access the MySQL prompt: mysql
- Execute the following query:?DELETE FROM ssg.audit_detail WHERE objectid = '[integer]';
Note that the value of "[image name]" and "[integer]" should be adjusted to accommodate for the desired backup image name and audit record identifier. After making the change, restart the Gateway appliance or service to force the Gateway application to try start again.