Saturday, March 27, 2010

Java OTA download error messages

In Java ME the success or failure of an OTA download attempt is reported by means of installation status reports. These status reports are posted to the server using the URL specified in the following JAD attributes: MIDlet-Install-Notify  for installations and MIDlet-Delete-Notify for deletions. Otherwise when the application installation fails it just displays the status code and a rather cryptic error message. I am going to document what I know about these errors.

900: Success: This means that the app has been successfully installed.

901: Insufficient Memory: If there is insufficient memory to store the app on the device, it returns this error.

902: User Canceled: It is returned when the user cancels the application download.

903: Loss of service: This status code is returned if the installation failed due to a network failure. Note that usually nothing is sent to server as the network connectivity itself is not available.

904: JAR size mismatch: If the downloaded application JAR file size does not match the size specified in the JAD file, this error is returned.

905: Attribute Mismatch: This error indicates that there is a mismatch between the JAD file attributes and those in the JAR file's manifest. The JAD file attributes (both key and value) that are in manifest file in JAR should match exactly.

906: Invalid Descriptor: The following attributes are mandatory and should be present in all JAD files.
  1. MIDlet-Name
  2. MIDlet-Version
  3. MIDlet-Vendor
  4. MIDlet-Jar-URL
  5. MIDlet-Jar-Size
And if any of these attributes are also in JAR file's manifest, then they will have to match exactly or else you will get this error.

In some cases, we need to specify MIDlet-Data-Size attribute in JAD and manifest files. This attribute will determine the amount of RMS allocated for the app. If you specify too much then the installation may be denied. Usually for apps not using RMS this attribute is not defined in JAD or manifest files. And other times when this error crops up, setting this attribute (with a 1024 size) fixes it.

907: Invalid JAR:  This is a server error. It occurs when the one of the following HTTP errors happen: 400, 402, 404, 405, 406, 408 etc. Mime type setting on server may be one possible cause. One other cause is the JAR file specified in MIDlet-Jar-URL line is not available for download.

For BlackBerry handsets sometimes we get this error: "907 invalid COD. Unable to import ZIP file". This is because someone was trying to download the COD files that were still zipped up. The JAR file should be unzipped and then the app should be downloaded.

908: Incompatible configuration or profile: Sometimes the error string will be "Application has malformed attribute". There may be a few possible causes like, the required JAD attributes in JAD file may be wrong. There may be a typo in the JAD file.

909: Application authentication failure: This is mostly caused because the application was signed incorrectly, or the signature did not match the certificate on handset.

910: Application authorization failure: This error happens when we are trying to replace a signed app on the handset with an unsigned one. It is especially noticable for preload handset which have apps baked in with the firmware. Its a common developer mistake to try to download a unsigned app on the preload handset, which has a signed version on it already.

911: Push registration failure: Dont know much about this error, but I think it is not supported anymore.

912: Deletion Notification: This error is displayed when we try to delete the app on the handset and the delete attempt fails. It usually happens for apps that were preloaded and thus cant be deleted. However, if we have a later version of the same app with correct signing then the older version can be overwritten.

No comments: