added series of fix. should work still not working...
finalized it, not working under glassfish 4, not investigating.