Relaunched Application Gets Encryption Key Error

Problem: When an application is relaunched, it gets the following error message:

com.sybase.persistence.PersistenceException: UltraLiteJ Error[-840]: Incorrect or missing encryption key

Explanation: There are messages queued in the messaging client, and the message handler starts to process messages before encryption is set.

Solution: Make sure Application.getInstance().startConnection() is called after encryption key is set.