Glassfish v2 Create Domain – Keytool Error:java.io.EOFException

Yesterday night, I had to work on some interesting stuff with my application’s deployment tool. We have a Ruby RakeFile to automatically create glassfish domain and deploy apps. As I was running the tool creating domains atleast 10 times or so, suddenly at one stage I got an error while creating glassfish domain…the error was “keytool error: java.io.EOFException”. I thought some evil spirits has got into my laptop at the wee hours…hence gave up and went off to sleep.

Today morning, I thought let me give this a fresh look…
And I learnt that you can turn on debug logging by adding -DDebug in the asadmin script. This helped me to say that there is something wrong with a keystore that Glassfish was looking for while creating the domain.

After couple of rounds of googling, I realized that the keystore is stored in my home folder with the name .asadmintruststore. Apparently the file size was just 1 byte. I just deleted the file and now the creation of domain went thru fine 🙂

On thinking what could have corrupted the keystore, I realized once when the creation of domain was going thru, I had abruptly killed the operation by Ctrl+C, which could possibly have corrupted the keystore!

Hope this helps someone who bumps on this issue 🙂

Moral of the story : Dont try to stay late and work…sleep early 🙂