My suggestion would be to start with plain Java classes that call a JINI service. Only after you have that working should you attempt to integrate your working classes into a web application. Trying to do it all in one step leads to hard to debug mystery errors.
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps