On the first day, I got everything to work with localhost, so if I opened http://localhost:8080/people/, then I would see the list of people. On the same day, I tried deploying to Heroku, but made a mistake with the environment variable values, so that didn't work.
On the next day, I realized what I had done wrong with the environment variable settings, fixed that, got past the initial error, and then got a 401 page with "HTTP Status 401 - Authentication Failed: OAuth login invalid or expired access token" from Apache Tomcat.
As a sanity check, I tried on localhost again and got the same 401 error page, even though everything had been fine on localhost before.
Finding nothing applicable by Googling, I finally tried deleting and re-creating the connected app for localhost from SalesForce, then putting the new Customer Key and Customer Secret values into the
OAUTH_CLIENT_SECRET values in the run configuration to see if that would help.
After doing the above and re-visiting http://localhost:8080/people/, I got the page asking me to confirm allowing access, but then right back to the 401 page with "HTTP Status 401 - Authentication Failed: OAuth login invalid or expired access token" from Apache Tomcat.
Any idea what's wrong? Any idea how to diagnose what's wrong?
== EDIT ==
I also just tried to open the http://localhost:8080/people/ page in a private session in the browser. I had to log into SalesForce again in the private session, confirm my identity via email, etc., then finally got the same error yet again. So… this is apparently not an issue with data in a cookie.