Search code examples
jsoupgcloud

Jsoup getElementById throws a NullPointerException only on GCloud VM


The jar run without errors on my local machine but when I load it on a Gcloud VM, Jsoup getElementById throws a NPE.

Document doc = Jsoup.connect(url).get(); works properly on both machines and I can print the doc, but

Element section = doc.getElementById("my_id");

throws NPE on VM (I verified section is actually null), I don't understand why.

OpenJDK11 is installed on VM


Solution

  • After printed doc as suggested in comment section, I noticed that the VM connected to a different web page (based on geo position) than the one in my local machine.