I get plenty of searches arriving at this blog looking for information about the infamous "907 Invalid JAR" Java ME OTA provisioning error. After 6 months of solid data from our provisioning platform I feel I am finally starting to understand the causes of this frustrating error.
Update: After Enrique's comment I decided to make my post more comprehensive so I have included the causes of 907 errors that one would encounter during development / early deployment phase. I will add to this post over time so that it becomes an all inclusive help file. Let me know if you have anything to contribute.
(1) Your manifest file or JAD are incorrectly formatted. Ensure the end-of-line characters are consistent and that the files are properly formatted (no weird spaces/line breaks). My recent troubles downloading the CNN application were as a result of a badly formatted manifest file.
(2) Your manifest or JAD are missing attributes (MIDP/CLDC declaration for example). This is easy to do if you are manually creating or editing your descriptor files. Rely on your build tools (J2ME Polish, Antenna, Netbeans, etc) to do this for you.
(3) The JVM you are targeting doesn't like something about your JAR. Even though your application works perfectly on Nokia and Sony Ericsson devices be prepared for some JVMs to throw this error when trying to install the application. The only solution for this is painful manual debugging. Strip your application down to the basics and slowly add features until you find the offending bit of code then refactor mercilessly until it works.
(4) The download times out and the network operator proxy server sends a message which the Java Application Manager (JAM) doesn't understand and it throws a 907. Ask your user to try again, maybe at a different (quieter) time of day. If people are persistent on slow networks they can still get the application. This error happens fairly regularly on all devices on slower 2.5G networks.
(5) The certification validation fails. If the application is certified ensure the device has the correct root certificates and the device date/time are set correctly.


Part of #1, is something wrong in the JAD or Manifest -- same respond, "strip your application...."
ceo
Right you are Enrique! I was starting from the perspective that you already had a confirmed correctly installing midlet on an SE or Nokia for instance. I should have clarified that.
A complete list of sources of Java installation error codes:
1) JSR 118, MIDP 2.1, page 21-25, for regular MIDlet OTA download
2) JSR 271, MIDP 3.0 (Early Draft), page 31-35, for downloading Record Management Stores
3) JSR 211, Content Handler API 1.0, page 16, for MIDlets installed as Content Handlers
4) OMA-Download_OTA-V1_0-20040625_A, page 18, and Implementation Best Practices for OMA DRM v1.0 protected MIDlets - 05 May, 2004, page 8, for downloading DRM-v1.0-protected MIDlets
5) OMA-TS-DLOTA-V2_0-20060907-C, page 38, for DRM-v2.0 downloading.
Description of error 907:
If the JAR is not available at the MIDlet-Jar-URL attribute in the descriptor, or the manifest or any other file can not be extracted from the JAR, or the JAR manifest is not in the correct syntax, or if any of the required attributes are missing in the JAR manifest, the device MUST return Status Code 907 in the Status Report.
If the certificate validation fails, you should get an error 909.
Thanks for the contribution Caspar. That's very useful information. To provide some context to my original post here are the top 10 devices (based on distinct user agent) which throw 907 errors on our application provisioning platform. None of these are as a result of an "official" cause of 907. Most are caused by number 4 (time outs) on my list.
Nokia/6600 - 182
Nokia/6300 - 151
Nokia/N70 - 125
Nokia/7610 - 98
Nokia/N70 - 90
Nokia/3230 - 82
Nokia/7610 - 81
Nokia/5300 - 70
Nokia/6300 - 57
Nokia/3230 - 53