I just ran into an error building our system using ant while documenting building a project under Windows. (Normally, we build under Unix).

The error was coming from the Ant signjar task:

jarsigner error: java.lang.RuntimeException: keystore load: Too many certificates in chain

A google search turned up multiple references to the string “Too many certificates in chain” but only one hit to this error with regards to the signjar task. Even then, that reference did not contain a solution. I investigated further and realized that when the keystore was checked into CVS, keyword expansion was not set to binary on the file. When the file is checked out on our Unix build machine, the keyword expansion was not causing an error. When the file is checked out on a Windows box, the keyword expansion breaks the build. Changing the keyword expansion to binary fixed the error.