I've added some code below which shows you how to check the cause of an error when loading a Portal or a PortalItem
Portal portal = new Portal("https://www.arcgis.com/");
System.out.println("loading portal");
portal.loadAsync();
portal.addDoneLoadingListener(()-> {
//check status of portal loading
System.out.println("Portal load status " + portal.getLoadStatus());
if (portal.getLoadStatus() == LoadStatus.LOADED) {
// portal loaded okay so let's try the portal item
PortalItem portalItem = new PortalItem(portal, "92ad152b9da94dee89b9e387dfe21acd");
portalItem.loadAsync();
portalItem.addDoneLoadingListener(()-> {
// check portal item load status
System.out.println("portal item load status " + portalItem.getLoadStatus());
if (portalItem.getLoadStatus() == LoadStatus.LOADED) {
// make map from portal item and add to mapview it displays
ArcGISMap map = new ArcGISMap(portalItem);
mapView = new MapView();
mapView.setMap(map);
// add the map view to the stack pane
stackPane.getChildren().addAll(mapView);
} else {
System.out.println("portal item failed to load");
System.out.println(portalItem.getLoadError().getCause());
}
});
} else {
System.out.println("portal failed to load");
System.out.println(portal.getLoadError().getCause());
}
});
I'm not sure why you are specifically getting the error above, but you might get some clues from the code above.
I would also not use Java 19, this isn't an LTS release and isn't supported. Ideally you should be using Java 21.
You should also read this blog post which says that we are about to deprecate the Java SDK, so you should consider an alternative technology for new projects.
Does this help?