1

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

Alberto
  • 11
  • 2
  • If you print `doc.toString()` or save it to file do you get the same result in both cases? – Krystian G Dec 10 '21 at 20:10
  • Thanks for the suggestion, the output were different because the VM connected to the global domain and the local to the Italian one. – Alberto Dec 12 '21 at 13:35

1 Answers1

0

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.

Alberto
  • 11
  • 2