When you open an ObjectInputStream it attempts to first read the "header" (which will automatically be created upon creating an ObjectOutputStream on the other end), which the API docs clearly state. And, since your groovy script is not creating an ObjectOutputStream for your java program to read your ObjectInputStream fails. Why are you even attempting to open any kind of InputStream on the Java side if your Groovy script is not sending anything? And your using a BufferedReader on the Groovy side will not work with an ObjectOutputStream from the Java side. It would only receive a lot of nonsensical garbage.
Edit: Okay, I see you are writing from the groovy side (although it is sometimes w and sometimes writer and neither, as far as I can see, is ever defined). But, it seems to be a Character stream. So again, why the Object Streams Java side and the character reader/writer on the groovy side. That is destined to fail.