InvalidQueryException is typically returned when running a query with a valid CQL syntax but the query itself is invalid.
But in your case where it's reporting an issue with schema_keyspaces, it is usually caused by using an older version of the Java driver connecting to a late-release Cassandra version.
If you're building a new app, we recommend that you use the latest version in the Java driver 4.x series. At the time of writing, the latest release is 4.13.
As a side note if you're just learning how to build apps for Cassandra, I recommend using Astra DB. You can launch a Cassandra cluster in just a few clicks and there's a free tier with no credit card required.
Astra DB also has Stargate.io already bundled in and pre-configured so you can connect to Cassandra using REST API, GraphQL API and JSON/Doc API. If you're interested, we have free hands-on interactive tutorials on Cassandra, Stargate and how to build apps at datastax.com/dev. Cheers!