Please edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
Could you explain how your application works? The posted code doesn't have any comments that describe what it does. Where is the -1 displayed?
Is there a way to test the code without a server? Do you have a testing driver?