Caused by: org.postgresql.util.PSQLException: ERROR: column "docdta" is of type bytea but expression is of type oid
Hint: You will need to rewrite or cast the expression."
Looks like that table has a column of type BYTEA, while the code expects it to be a LOB. Perhaps the easiest fix is to change the table to store a LOB instead?
One of the benefits of doing that is that you can "stream" LOB's (you access it like a file; opening, reading, seeking), whereas AFAIK you have to retrieve BYTEA data as a whole before you can start sending it to the client.