How to fix "java.security.InvalidKeyException:" error?

Follow

Shashank Srivastava -

Issue

You export CI(s) using XL Deploy CLI's method fileName = repository.exportCisAndWait('Applications'). Then you try to import this zip file to another instance of XL Deploy. Upon executing the CLI command, import will fail & you will see something like below in the XL Deploy log.

java.security.InvalidKeyException: Infrastructure_2018-02-22_02-45-40_040.zip was exported with different key fingerprint: a4f1b75860ec45b2c3dd82e557c2526a1d74f582. Fingerprint of this server: ff6e17959f9a847e085ae4e5ab3a74f368433433
Environment

XL Deploy, CLI

Resolution

To fix this error, you will need to use the same encryption key for second XL Deploy instance if you want to import the zip file from source instance. For this, simply copy XLD_HOME/conf/repository-keystore.jceks file from instance A to instance B & restart instance B. Afterwards, you will be able to import the file.

You will see that import has been successful.

2018-02-22 07:33:04.684 [task-sys-task.step-dispatcher-17] {stepDescription=Import configuration items from 'Path(Infrastructure_2018-02-22_02-45-40_040.zip)', taskId=10909399-bbc1-4d1d-9f2b-654fc7f2dd58, username=admin} INFO  c.x.deployit.engine.tasker.TaskStep - EXECUTING
2018-02-22 07:33:04.698 [task-sys-task.state-management-dispatcher-16] {taskId=10909399-bbc1-4d1d-9f2b-654fc7f2dd58, username=admin} INFO  c.x.d.e.tasker.PhaseExecutingActor - [BlockPath(0_1_1)] : All sub blocks of [BlockPath(0_1_1)] completed with state DONE, notifying parent 
Cause

This happens because you are using a different repository encryption key for XL Deploy instance A than instance B.

The exported zip on instance A has been encrypted with a different key which instance B doesn't know how to decrypt & import.

Additional Information

Below is the complete stack-trace that is seen when this issue occurs.

2018-02-22 07:25:27.941 [task-sys-task.step-dispatcher-18] {stepDescription=Import configuration items from 'Path(Infrastructure_2018-02-22_02-45-40_040.zip)', taskId=31bb7244-137d-41d8-b0ff-da8c19ec3aba, username=admin} ERROR c.x.x.e.exportcis.ImportStep - Failed to import Path(Infrastructure_2018-02-22_02-45-40_040.zip)
java.security.InvalidKeyException: Infrastructure_2018-02-22_02-45-40_040.zip was exported with different key fingerprint: a4f1b75860ec45b2c3dd82e557c2526a1d74f582. Fingerprint of this server: ff6e17959f9a847e085ae4e5ab3a74f368433433
at com.xebialabs.xlplatform.extensions.exportcis.archive.RepositoryImporter$$anonfun$import$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$1.apply(RepositoryImporter.scala:90)
Tags

xldeploy, troubleshooting, how-to, export, import, cli

Have more questions? Submit a request