Query cache doesn't take in account capability CLIENT_DEPRECATE_EOF.
This flag change query result data : suppressing some EOF, or replacing some with OK_Packet for example.
Since query cache doesn't check this field in query cache data structure : https://mariadb.com/kb/en/mariadb/query-cache/#query-cache-internal-structure
corresponding source : https://github.com/MariaDB/server/blob/10.2/sql/sql_cache.cc#L1413
If a driver that doesn't set CLIENT_DEPRECATE_EOF capability execute a query that can be cached, another driver that support CLIENT_DEPRECATE_EOF will have a resultset in a format not expected if executing the same query. (the opposite is true too).
In term of error with java driver, resulting errors can be :
workaround is to disable query cache (see documentation) or to not mix drivers that support CLIENT_DEPRECATE_EOF with other that don't support this capability