Store Server Development Troubleshooting
This document tries to help with specific information from the point of view of an error or message in the log.
org.openbravo.authentication.AuthenticationException: Invalid token - javax.crypto.BadPaddingException: Given final block not properly padded
This message is printed in the log together with a stack trace. It is related to the multi-server authentication mechanism used in the OB commerce solution. We use a symmetric key approach with an auto-generated key stored in the client table (see the relevant column in that table).
There are two causes for this message:
- different servers in your environment have different authentication keys
- a webpos system has been idle for too long and its key is expired
The first cause will print the error/stacktrace many times in the log, the error is repeated at every inter-server communication and also when WebPOS connects to different servers. The second cause will be printed a few times in the log but not too much.
All the servers in the system should have the same authentication key value in the column in the client table for the relevant clients. When exporting a store from a central server this value is normally already set in the central server and exported in the store data. However, if you set up the store server completely separate it is possible that it starts with an empty key column and will generate its own unique and different value in that column.
The solution is to distribute the new authentication key from the central server to the store server.
If replication is setup correctly you can do this by touching the relevant client record in the client window. Touching can be done by changing the description of the client for example. Another approach is to generate a completely new key, which will then be distributed to all store servers. This can not be done while the WebPOS systems are actively being used.
If replication is not operating then the only option is to manually copy the value from the central server to the store server.
A WebPOS system when logging receives a new authentication token. This token is regenerated automatically while the user is active. The token has a timestamp and there is a max age preference which controls how old the authentication token can be.
If the WebPOS is not being used it is still possible that periodically a ping is sent to the servers in the environment. The ping does not recreate the token so if there are no other actions eventually it will expire and create the log message.
Since the fix of this issue the maximum number of times it logs the message is limited.
WARN org.jumpmind.symmetric.service.impl.PushService - Registration was not open at
This warning shows up in the log and replication does not work between the central and store server. OB has a save guard to not allow unintended registration of servers in Symmetric DS. To resolve this, go to the mobile server definition window in the Central server and for the store server check the 'Can be registered' checkbox.
Replication not working
A common reason for replication not working is that initial registration did not complete successfully. A cause can be that the symmetric ds was uninstalled on central but not on the store. To reregister a store you can uninstall symmetric ds on the store server. It will automatically be re-installed.
Another reason is that there are synchronization errors. Synchronization errors will block replication of other data. Also note that the replication stops after 5 retries. So even if you resolve a replication error the replication process has to be restarted for a store server through the Registered Server window.
Initial longer startup time of the store server
When the store server is started the first time it will contact the central server to obtain the replication definition. With this information the store server replication layer is initialized. This retrieval and initialization can take several minutes. Subsequent starts of the store server should not have a delay as the initialization has then already happened.
BUILD FAILED, ant uninstall.symmetric.ds not working
This issue is shown with an error like this, with a very long list of jar files:
openbravo@ip-10-0-0-230:/opt/Openbravo-ERP/openbravo/modules/org.openbravo.replication.symmetricds$ ant uninstall.symmetric.ds Buildfile: /opt/Openbravo-ERP/openbravo/modules/org.openbravo.replication.symmetricds/build.xml uninstall.symmetric.ds: create.synchronization.properties.file: BUILD FAILED /opt/Openbravo-ERP/openbravo/modules/org.openbravo.replication.symmetricds/build.xml:101: The following error occurred while executing this line: /opt/Openbravo-ERP/openbravo/modules/org.openbravo.replication.symmetricds/build.xml:82: taskdef class org.openbravo.replication.symmetricds.task.CreateSynchronizationPropertiesIfNeededTask cannot be found using the classloader AntClassLoader[/opt/Openbravo-ERP/openbravo/build/classes:/opt/Openbravo-ERP/openbravo/lib/build/YUIAnt.jar:/opt/Openbravo-ERP/openbravo/lib/build/js.jar:/opt/Openbravo-ERP/openbravo/lib/build/ob-rhino-1.6R7.jar:/opt/Openbravo-ERP/openbravo/lib/build/servlet-api.jar:/opt/Openbravo-ERP/openbravo/lib/build/yuicompressor- ... ...
To solve it try the following in both central and store:
- ant smartbuild -Dlocal=no -Dforce=true, in both central and store
- ant compile.deploy
Then within the org.openbravo.replication.symmetricds module in both central and store execute: ant update.symmetric.ds.configuration
Store Server does not go online
There can be several reasons why a store server does not go online. See this link for more details.